BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
didymo
Fluorite | Level 6

I know how to do one-sided t test for mean equal to 0 in proc ttest but I am using another procedure in which for some of the data one of two means is zero.  In these cases, I want to test using proc lifereg if the non-zero mean is equal to a specified value, such as zero.  The reason for using lifereg is left censoring of the data.  Any thoughts on how this can be done by modifying the estimate statement and maybe adding / testvalue=0; ?  Thank you, Brad

 

proc lifereg data=three; 

   class season;

   model (lnymiss, lnydl)=season / distribution = normal;

   estimate 'Fall mean - Spring ANOVA' season 1 -1;

   lsmeans season;

   

1 ACCEPTED SOLUTION

Accepted Solutions
didymo
Fluorite | Level 6
SteveDenham, Thanks. If I add "/ upper" to the lmestimate statement that should provide the one-tailed test, right?

lsmestimate season 'One-tailed test of Spring >=0, when fall mean=0' 0 1 / upper;

View solution in original post

6 REPLIES 6
SteveDenham
Jade | Level 19

You could use an LSMESTIMATE statement and some DATA step programming.  For instance, suppose you wanted to test if the mean for the Spring level of season is zero (as an example), you would write in LIFEREG:

 

lsmestimate season 'One-tailed test of Spring >=0' 0 1;
ODS output lsmestimates=lsmestimates;

The DATA step would use the CDF function to find the probability in the right hand tail of the t distribution.

 

data testlsmest;
set lsmestimates;
tval=estimate/stderr;
probrighttailrejected =  cdf('t',tval, df);
run;

SteveDenham

 

 

didymo
Fluorite | Level 6
Thank you! However, SAS did not provide the probrighttailrejected or df, just “.” In the output table.

data testlsmest;
set lsmestimates;
tval=estimate/stderr;
probrighttailrejected = cdf('t',tval, df);
run;

SteveDenham
Jade | Level 19

That looks like tval is not defined, which in turn says something about the variable names in the dataset lsmestimates. I pulled the variable names from a dataset created by a different PROC, which resulted in what was expected.  It may be that when LIFEREG creates the ODS dataset, either the mean or the standard error has a different variable name.

 

SteveDenham

didymo
Fluorite | Level 6
SteveDenham, Thanks. If I add "/ upper" to the lmestimate statement that should provide the one-tailed test, right?

lsmestimate season 'One-tailed test of Spring >=0, when fall mean=0' 0 1 / upper;
SteveDenham
Jade | Level 19

That should do it.

 

I should read the documentation before I recommend a work-around🙄

 

SteveDenham

didymo
Fluorite | Level 6
Thank you again!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 861 views
  • 0 likes
  • 2 in conversation