Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- one-sided test for mean equal to 0 in proc lifereg

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 05-05-2021 12:17 AM
(785 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

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

6 REPLIES 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

data testlsmest;

set lsmestimates;

tval=estimate/stderr;

probrighttailrejected = cdf('t',tval, df);

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

That should do it.

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

SteveDenham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you again!

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

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.