Displaying 1 result from an estimated 1 matches for "norm_function".
Did you mean:
non_function
2002 Feb 22
2
errors in integrate function?
...0.02054692 with absolute error < 4.5e-13
The correct answer is the second. But with rel.tol=1e-6, the answer
returned is off by 1e-2 even though the error reported is 8e-11.
The error can be further demonstrated by checking the integral for a
sequence of values, x=seq(-5,25,by=0.1).
dgamma.norm_function(x,shape,scale,stdev)
{
prob=numeric()
for(i in 1:length(x))
prob[i]=integrate(gamma.by.normal,lower=0,upper=Inf,rel.tol=1e-6,
x=x[i],shape=shape,scale=scale,stdev=stdev)$val
return(prob)
}
> y=dgamma.norm(x,shape=1,scale=4,stdev=.2)
> plot(x,y)
The errors...