Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: st: RE: mean of a distribution


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   AW: st: RE: mean of a distribution
Date   Sun, 18 Oct 2009 20:53:35 +0200

<> 

You can of course have Stata draw random numbers from the exponential
distribution and see whether the relationships holds:



*************

capt prog drop myprog
prog def myprog
	vers 10.1
	syntax [,lambda(real 1)]
		qui{
			drop _all
			set obs 10000
			tempvar x
			gen `x'= (-1/`lambda')*log(runiform())
		}
	su `x', mean
	di in r _n "Mean with lambda equal to "  /* 
	*/ %2.1fc `lambda' " : " r(mean)
end

forv i=0.1(0.1)3{
	myprog, lambda(`i')
}
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von carol white
Gesendet: Sonntag, 18. Oktober 2009 20:36
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: RE: mean of a distribution

Thanks for all responses. 

I just wanted to find out how could one have calculated the mean for example
of the exponential distribution if the mean were not known (inverse of
lambda)? Or as Martin called it shortcut, if the shortcut were not known?

Carol

--- On Sun, 10/18/09, Nick Cox <n.j.cox@durham.ac.uk> wrote:

> From: Nick Cox <n.j.cox@durham.ac.uk>
> Subject: st: RE: mean of a distribution
> To: statalist@hsphsun2.harvard.edu
> Date: Sunday, October 18, 2009, 11:12 AM
> Not sure what you're asking here. 
> 
> One way to think about this parameterisation, or any other,
> is by using
> dimensional analysis. The density of a univariate
> distribution for x
> must have units that are the reciprocal of the units of x.
> It follows
> that lambda has such units, and the mean, having the units
> of x, must be
> proportional to the reciprocal of lambda. That doesn't give
> you the
> proportionality constant of 1, which follows from the rest
> of the
> definition, but it makes the reciprocation intuitive. 
> 
> David Finney wrote a splendid article about dimensional
> analysis and
> statistics:
> 
> D. J. Finney. 1977.  
> Dimensions of statistics. 
> Journal of the Royal Statistical Society. Series C (Applied
> Statistics),
> 26: 285-289. 
> 
> This is on JSTOR, if you have access to that. 
> 
> Nick 
> n.j.cox@durham.ac.uk
> 
> 
> carol white
> 
> How to calculate the mean of the distribution of a random
> variable? Take
> the exponential distribution with the probability density
> function
> f(x)=lambda.exp(-lambda.x) where lambda is a constant and x
> is a random
> variable. The mean of this distribution is the reciprocal
> of lambda. If
> the mean is the expected value of x, which for a continuous
> random
> variable E(x) = Integral (x.f(x))dx, how could E(x) be the
> reciprocal of
> lambda?
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



      

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index