Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: stored p-value of sts test


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: stored p-value of sts test
Date   Fri, 20 Jan 2012 18:33:09 +0000

You'll have to work out the P-value from the other r-class results to do this. Look up the chi-squared functions under -help density functions-. 

By the way, there seems some confusion here. 

-sts- does accept -if- qualifiers (not statements), which select observations to be used. 

But you want to see a graph conditional on whether the result is significant. That's a completely different -if-, the -if- command. 

People often confuse -if- and -if-; if so, it is not surprising.

FAQ     . . . . . . . . . . . . . . . . . . . . .  if command vs. if qualifier
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  J. Wernow
        6/00    I have an if or while command in my program that
                only seems to evaluate the first observation,
                what's going on?
                http://www.stata.com/support/faqs/lang/ifqualifier.html
 
Schematically you want 

sts test `x', logrank
<calculate P-value> 
if <P-value> < 0.05 { 
	sts graph, by(`x') tmax(60)
	graph save `x', replace
} 

(Consider sprinkled here mild disquiet and strong cautions about using significance tests in this way from the ghost of R.A. Fisher, an early Hogwarts student.) 

Nick 
[email protected] 

Steve Nakoneshny

I am performing some exploratory analyses in an stsetted dataset using Stata 11.2 for Mac.

As part of a loop, I coded the following:

-- start code --

sts test `x', logrank
sts graph, by(`x') tmax(60)
graph save `x', replace

-- end code --

My local `x' comprises 18 variables, so the loop generates more graphs than I actually want to save. Looking at the help, I see that -sts graph- accepts -if- statements. What I would like to do is only graph (and save) where -sts test- is statistically significant (p<0.05). According to -help-, -sts test- doesn't save the p-value in r().

What I would like to know is whether or not the p-value is stored somewhere else (if at all) or if there is an alternate workaround I can implement.


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index