From: roger koenker <roger_at_ysidro.econ.uiuc.edu>

Date: Mon 28 Aug 2006 - 03:17:57 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon Aug 28 04:32:46 2006

Date: Mon 28 Aug 2006 - 03:17:57 EST

General questions elicit general answers; more specific questions elicit more specific answers. For example,

> exp(2+9/2)

[1] 665.1416

url: www.econ.uiuc.edu/~roger Roger Koenker email rkoenker@uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Champaign, IL 61820

On Aug 27, 2006, at 11:52 AM, Paul Smith wrote:

> On 8/26/06, Mike Nielsen <mr.blacksheep@gmail.com> wrote:

*>> Yes.
**>>
**>>> Can R compute the expected value of a random variable?
**>
**> Mike: thank you very much indeed for your so insightful and complete
**> answer. I have meanwhile deepened my research and, as a consequence,
**> I have found the following solution, which seems to work fine:
**>
**>> integrand <- function(x){x*dlnorm(x,meanlog=2,sdlog=3)}
**>> integrate(integrand,-Inf, Inf)
**> 665.146 with absolute error < 0.046
**>>
**>
**> There is also a package apt to calculate expected values: it is called
**> distrEx. (Thanks, Matthias.)
**>
**> Paul
**>
**> ______________________________________________
**> R-help@stat.math.ethz.ch mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide http://www.R-project.org/posting-
**> guide.html
**> and provide commented, minimal, self-contained, reproducible code.
*

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon Aug 28 04:32:46 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Mon 28 Aug 2006 - 06:22:35 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*