[R] Expectation of E(x^1/2)
Ravi Varadhan
rvaradhan at jhmi.edu
Sun Apr 11 07:04:24 CEST 2010
Chuck showed how to do this:
fn <- function(x) sqrt(x) * dnorm(x)
> integrate(fn, 0, Inf)
0.4110895 with absolute error < 4.7e-05
>
So the (almost) exact answer is 0.4110895 + 1i * 0.4110895
Ravi.
____________________________________________________________________
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvaradhan at jhmi.edu
----- Original Message -----
From: Ben Bolker <bolker at ufl.edu>
Date: Sunday, April 11, 2010 1:00 am
Subject: Re: [R] Expectation of E(x^1/2)
To: r-help at stat.math.ethz.ch
> Haneef Anver <haneef9 <at> yahoo.com> writes:
>
> > I am trying to find the expectation of x^1/2 where x~N(a,b)
> > ( Normal with mean a and variance b).
> > Any feedback would be highly appreciated.
>
> I have no idea at the moment how to start doing
> this analytically, but is this at all helpful?
>
> > mean(sqrt(complex(re=rnorm(1000000))))
> [1] 0.4114712+0.4103866i
>
> ______________________________________________
> R-help at r-project.org mailing list
>
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list