Hi all
my apologies if above title is misleading, but here is my problem anyways:
I need to evaluate an integral n times. Since I can't get my head around
vectorization as of yet, I have coded it up in a loop, i.e.:
for (i in 1:n)
{
z[i] - integrate(dnorm,x[i],Inf)
}
Since n is
I think I have figured it out myself, would however like to know the opinion
of more experienced coders. Is this a good way of approaching this:
cumdnorm1 - function(x) {integrate(dnorm,x,Inf)}
evalvec - function(x) {lapply(x,cumdnorm1)}
It does return the desired result.
Tobias wrote:
Or just:
lapply(x, integrate, f = dnorm, upper = Inf)
On 10/11/06, Tobias [EMAIL PROTECTED] wrote:
I think I have figured it out myself, would however like to know the opinion
of more experienced coders. Is this a good way of approaching this:
cumdnorm1 - function(x)