Re: [R] about the integrate

2013-11-21 Thread Rolf Turner
Think about what you are actually getting from pnorm(). For each scalar "s" you want to get pnorm(s,mu[2],sigma[2])pnorm(s,mu[3],sigma[3]) pnorm(s,mu[4],sigma[4]) (and then take products of things). But when "s" is a vector you get pnorm(s[1],mu[2],sigma[2])pnorm(s[2],mu[3],si

[R] about the integrate

2013-11-21 Thread dan wang
Hi all, I tried below two methods to calculate the integrate of a same function. Two different results are given. The first one should be the right answer. Can any one help to explain why? Another issue is, the first one is not convenient as I have to update the mu and sigma outside the function.