Re: [R] Can R compute the expected value of a random variable?
On 8/26/06, Mike Nielsen [EMAIL PROTECTED] 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.
Re: [R] Can R compute the expected value of a random variable?
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/~rogerRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 On Aug 27, 2006, at 11:52 AM, Paul Smith wrote: On 8/26/06, Mike Nielsen [EMAIL PROTECTED] 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.
Re: [R] Can R compute the expected value of a random variable?
On 8/27/06, Paul Smith [EMAIL PROTECTED] wrote: On 8/26/06, Mike Nielsen [EMAIL PROTECTED] 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. Answers are often in proportion to the questions that solicited them. Suggest you read the posting guide (link near bottom of every message to r-help) or at least read the advice in the last line on every message to r-help. __ 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] Can R compute the expected value of a random variable?
Dear All Can R compute the expected value of a random variable? Thanks in advance, 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.
Re: [R] Can R compute the expected value of a random variable?
Yes. On 8/26/06, Paul Smith [EMAIL PROTECTED] wrote: Dear All Can R compute the expected value of a random variable? Thanks in advance, 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. -- Regards, Mike Nielsen __ 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.