I'm trying to provide different parameters to the integrate function for various probability functions. I'm using dnorm as the simplest example here. For instance integrate(dnorm, -1.96, 1.96) produces the correct answer for a normal distribution with mean 0 and standard deviation 1. I've tried two ways to use mean=2.0 and standard deviation 1, but with no luck. The examples follow.
integrate(dnorm, -1.96, 1.96)
0.9500042 with absolute error < 1e-11
mean = 2.0
sd = 1.0
integrate(dnorm, -1.96, 1.96)
0.9500042 with absolute error < 1e-11
integrate(dnorm(mean=2.0,sd=1.0), -1.96, 1.96)
Error in .Internal(dnorm(x, mean, sd, log)) : 'x' is missing
Calls: integrate -> match.fun -> dnorm
Execution halted
How do I change the built in mean=0 and standard deviation=1 for dnorm using integrate?
Thanks,
Frank
Chicago, IL
[[alternative HTML version deleted]]