turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Proc Logistic & Confidence Intervals....Contrast v...

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-03-2015 12:10 PM

Hello-

I have a fairly basic logisitic regression model looking at the effect of time on bacterial growth. This model also includes a simple spline term, where the spline term begins at time= 10, and for all values after time=10 the spline= (time - 10).

What I want is the slope after time= 10, which =exp(β_{1}+ β_{2}).

How do I get a confidence interval for this particular slope. I do not want to compare the slope from time < 10, I only want the confidence interval for exp(β_{1}+ β_{2}). Am I wrong that the contrast and estimate statements will provide me with odds ratio values, as opposed to just the isolated slope of the combined terms??

For what it's worth, here's the basic model in SAS:

**proc** **logistic** data= growth_data descending;

model growth= time spline

**run**;

Log(odds)= β_{0} + β_{1}(time) + β_{2}(spline term for time)

As a visual, what I'm interested in is the slope and confidence interval for the blue section

Accepted Solutions

Solution

11-18-2015
12:19 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-05-2015 04:33 PM

I was mayto to quick when I read your question. I just noted that you asked for the slope. The slope estimate comes automatically.

Maybe you can use this code to get confidence intervals around the line:

data mydata;

do i=1 to 100000;

time=rand('uniform',0,20);

spline=max(time-10,0);

logodds=0.75-0.05*spline;

p=1/(1+exp(-logodds));

y=rand('bernoulli',p);

output;

end;

keep y spline;

run;

*you get automatically estimates of the slope (approximately -0.05);

proc logistic data=mydata desc;

model y=spline;

run;

*if you want the estimate at a specific value for time you can use estimate statement:;

proc logistic data=mydata desc;

model y=spline;

estimate 'value at time=15' intercept 1 spline 5/exp;

run;

*(its "spline 5" because 15-10=5);

*its also possible to get the confidence intervals by use of the "store statement" and proc plm;

proc logistic data=mydata desc;

model y=spline;

store result;

run;

data spline;

do spline=0 to 10 by 0.1;

time=10+spline;

output;

end;

run;

proc plm restore=result;

score data=spline out=spline2 predicted=p lclm uclm lcl ucl;

run;

Maybe you can use this code to get confidence intervals around the line:

data mydata;

do i=1 to 100000;

time=rand('uniform',0,20);

spline=max(time-10,0);

logodds=0.75-0.05*spline;

p=1/(1+exp(-logodds));

y=rand('bernoulli',p);

output;

end;

keep y spline;

run;

*you get automatically estimates of the slope (approximately -0.05);

proc logistic data=mydata desc;

model y=spline;

run;

*if you want the estimate at a specific value for time you can use estimate statement:;

proc logistic data=mydata desc;

model y=spline;

estimate 'value at time=15' intercept 1 spline 5/exp;

run;

*(its "spline 5" because 15-10=5);

*its also possible to get the confidence intervals by use of the "store statement" and proc plm;

proc logistic data=mydata desc;

model y=spline;

store result;

run;

data spline;

do spline=0 to 10 by 0.1;

time=10+spline;

output;

end;

run;

proc plm restore=result;

score data=spline out=spline2 predicted=p lclm uclm lcl ucl;

run;

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2015 06:00 PM

Make this variable

Spline=max(time-10,0);

and add it in the model statement.

Estimate and confidence intervals then comes automatically.

Spline=max(time-10,0);

and add it in the model statement.

Estimate and confidence intervals then comes automatically.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-05-2015 12:12 PM

Hi-

Thanks for the response! I currently have the spline term already constructed and in the model, and can find the confidence interval for that term alone, but need the combined confidence interval.

What I should add is that I can currently use the outest= covout option and then use the variance and covariance values to calculate the standard error and then use that to calculate the upper and lower confidence limits...but it's extremely clunky and I imagine SAS has a better way.

However, I was not aware that you could code values using the comma to indicate an 'other' value. That's way simpler than writing if then/ else statements. Many thanks for the new info!!

Solution

11-18-2015
12:19 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-05-2015 04:33 PM

Maybe you can use this code to get confidence intervals around the line:

data mydata;

do i=1 to 100000;

time=rand('uniform',0,20);

spline=max(time-10,0);

logodds=0.75-0.05*spline;

p=1/(1+exp(-logodds));

y=rand('bernoulli',p);

output;

end;

keep y spline;

run;

*you get automatically estimates of the slope (approximately -0.05);

proc logistic data=mydata desc;

model y=spline;

run;

*if you want the estimate at a specific value for time you can use estimate statement:;

proc logistic data=mydata desc;

model y=spline;

estimate 'value at time=15' intercept 1 spline 5/exp;

run;

*(its "spline 5" because 15-10=5);

*its also possible to get the confidence intervals by use of the "store statement" and proc plm;

proc logistic data=mydata desc;

model y=spline;

store result;

run;

data spline;

do spline=0 to 10 by 0.1;

time=10+spline;

output;

end;

run;

proc plm restore=result;

score data=spline out=spline2 predicted=p lclm uclm lcl ucl;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-18-2015 12:19 PM

Thanks for the help! I wasn't familiar with proc plm, always great to learn something new!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-18-2015 12:59 PM

PROC PLM is awesome. See the article "Tecniques for scoring a regression model" for another example.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-18-2015 01:05 PM

Rick-

Thanks for the link. I've heavily relied on your blog posts for many, many of my SAS questions!