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;
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
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
That should do it.
I should read the documentation before I recommend a work-around🙄
SteveDenham
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.