Statalist


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

Re: AW: AW: st: Weibull


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   Re: AW: AW: st: Weibull
Date   Sun, 8 Mar 2009 18:26:39 +0100

<>
Your version was perfectly fine (no "risk") and would deliver the same results as my (shorter) one. -summ, mean- is to be preferred if all you want is -r(mean)- or -r(max)- etc. You can omit your -return scalar- statement if all you want is the result set of the -summarize- line. Anyway, sorry for distracting from the main subject of this thread...


HTH
Martin
_______________________
----- Original Message ----- From: "Muhammad Riaz" <[email protected]>
To: <[email protected]>
Sent: Sunday, March 08, 2009 6:02 PM
Subject: Re: AW: AW: st: Weibull


Hi Martin,

Would you please comment on the potential use of -rclass-, I mean when it would be necessary to use it. Is there any risk while using it here in this program?
Thank you

Muhammad

--- On Sun, 3/8/09, Martin Weiss <[email protected]> wrote:

From: Martin Weiss <[email protected]>
Subject: AW: AW: st: Weibull
To: [email protected]
Date: Sunday, March 8, 2009, 8:09 PM


<>


The speed improvement may be slight, but it is good to know that if all you
want is the returned results of -summarize-, you do not want an -rclass-
statement at the top of your  -program-...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Muhammad Riaz
Gesendet: Sonntag, 8. März 2009 16:07
An: [email protected]
Betreff: Re: AW: st: Weibull

Thank you Martin,

Muhammad Riaz

--- On Sun, 3/8/09, Martin Weiss <[email protected]> wrote:

From: Martin Weiss <[email protected]>
Subject: AW: st: Weibull
To: [email protected]
Date: Sunday, March 8, 2009, 7:49 PM


<>

I think you can economize on lines here:


*************
capture program drop wsim
program define wsim
   version 9.2
   syntax [, obs(integer 1) lambda(real 0.8) gamma(real 0.4) ]
   drop _all
   set obs `obs'
   tempvar time event
   gen `time' = ((log(1-uniform()))/-`lambda')^(1/`gamma')
   summarize `time', mean
end
simulate time=r(mean), reps(1000): wsim, obs(100)
gen event= time< 5
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Muhammad Riaz
Gesendet: Sonntag, 8. März 2009 15:45
An: [email protected]
Betreff: Re: st: Weibull

Hi Nikolaos,
You might have sorted out your simulation from weibull, I just managed to
write the codes given below: I thought it may help to thread it here  in
connection to your  query  for simulation from weibull and get further
advices from others.


capture program drop wsim
program define wsim, rclass
version 9.2
syntax [, obs(integer 1) lambda(real 0.8) gamma(real 0.4) ]
drop _all
set obs `obs'
tempvar time event
gen `time' = ((log(1-uniform()))/-`lambda')^(1/`gamma')
summarize `time'
return scalar mean = r(mean)

end
simulate time=r(mean) , reps(1000): wsim, obs(100)
gen event= time< 5

HTH

Muhammad Riaz

--- On Mon, 3/2/09, Nikolaos Pandis <[email protected]> wrote:

From: Nikolaos Pandis <[email protected]>
Subject: Re: st: Weibull
To: [email protected]
Date: Monday, March 2, 2009, 9:48 PM

Dear Bobby,

Thank you very much for the posting.

I have the previous version of the book on survival analysis with Stata that you have coauthored with M. Cleves and W. Gould. Any sections in there that
will help me with the current problem?

Best wishes,

Nikolaos

--- On Mon, 3/2/09, Roberto G. Gutierrez, StataCorp <[email protected]>
wrote:


From: Roberto G. Gutierrez, StataCorp <[email protected]>
Subject: Re: st: Weibull
To: [email protected]
Date: Monday, March 2, 2009, 6:15 PM


Nikolaos Pandis <[email protected]> asks:

I would like to generate continuous data for two groups for which I would
like to evaluate whether there is a difference between their means (I
could
use use a t-test). I would like to be able to set the mean and sd of the
two
groups. The data would represent bond failure strength (in MPa) of two
different materials (the 2 groups).

Additionally, I would like to generate data for the same experiment that
follows the Weibull distribution and compare the two groups.

It is of interest to see the results of the analysis on the data under the
ttest analysis and under an analysis suitable for the Weibull
distribution.
The objective is to show how different analyses of similar data might
point
to different results, and the importance of selecting the correct
distribution and analysis.

Nikolaos has already received some very good advice, to which I would only
add
that I have written the routine -gengammareg- available via

  . findit gengammareg

-gengammareg- generates data from gamma regression as implemented by
-streg-,
but also includes as special cases the exponential, Weibull and lognormal
distributions; see -help gengammareg- after installing.

The two-sample test Nikolaos describes can be retooled as regression on a
dummy variable, allowing the use of -gengammareg- here.

--Bobby
[email protected]
*
*   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/


*
*   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/





*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index