Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Generating random variable through rnd and rndwei and Weibull fits


From   [email protected]
To   [email protected]
Subject   st: Generating random variable through rnd and rndwei and Weibull fits
Date   Mon, 08 Aug 2005 19:33:32 -0400

Hello Statalisters --

There have been a few threads over the last several days re:
distributions, distribution selection, generating distributions etc.  I
note particularly the threads entitled "Generating random variables from
the logistic distribution" and what I think is the recent updating of
the SSC package RND by Kit Baum.  Anyway, I thought I would try that out
and generate a weibull distribution and then use Nick Cox's packages
-wfit-, -qweibull- and -pweibull- to see how well the RND routines from
SSC did in generating a Weibull distribution.  I generated 10000 values
from a Weibull distribution with a shape of 3 and a scale of 2 as per an
example in the rnd package help file. But when I used the following
sequence of commands (see below), it seems like there might be a
mismatch because  instead of the scale parameter of 2 (which I used to
generate the data), I get one of 0.5 (its inverse) back. The graphs
generated by Nick's programs seem to do very well (perfect straight
lines) except they didn't provide back the parameters  that I thought
they would.  Maybe I am mixing up the terminology (b vs. c parameters,
scale vs. shape) or not doing the appropriate backconversion to get the
original parameters. Or is their perhaps a concern?

Notes:
      1.  (/m# option or -set memory-) 10.00 MB allocated to data
      2.  (/v# option or -set maxvar-) 5000 maximum variables

. ssc install rnd, replace
checking rnd consistency and verifying not already installed...
all files already exist and are up to date.

. help rnd

.  rndwei 10000 3 2
( Generating . )
Variable xw created.

. wbull xw

Fitting Weibull distribution to xw

b               0.49809
c               3.02015

. qweibull xw

Fitting Weibull distribution

           b:  exp(_b[_cons])
           c:  exp([ln_p][_cons])

------------------------------------------------------------------------------
          xw |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
           b |   .4980915   .0017364   286.86   0.000     .4946883
.5014947
           c |    3.02015   .0235553   128.22   0.000     2.973982
3.066317
------------------------------------------------------------------------------


. pweibull xw

Fitting Weibull distribution

           b:  exp(_b[_cons])
           c:  exp([ln_p][_cons])

------------------------------------------------------------------------------
          xw |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
           b |   .4980915   .0017364   286.86   0.000     .4946883
.5014947
           c |    3.02015   .0235553   128.22   0.000     2.973982
3.066317
------------------------------------------------------------------------------

. qweibull xw, param( 0.49 3)

. qweibull xw, param( 2 3)

. query born
05 Jul 2005

. which rndwei
c:\ado\plus\r\rndwei.ado
*!version 1.1 1999 Joseph Hilbe

.

thanks for any help that might be offered.



david



David J. Miller, Chief
Chemistry & Exposure Branch
Health Effects Division
Office of Pesticide Programs
U.S. Environmental Protection Agency
703-305-5352 (voice)
703 605-1289 (fax)

visit: http://www.epa.gov/pesticides/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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