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

 

Dear all,

 

In a matched case-control study, the outcome is case (0/1), the predictor variable is the continuous substance1. The best model had two fractional polynomials, i.e., substance1 squared (named substance1_2) and substance1 raised to the power of 3 (named substance1_3).

I ran PROC LOGISTIC with model case = substance1_2 substance1_3.

I managed to calculate the odds ratio for a change in substance1 from 15 to 5 units. In order to calculate the 90% CI, I will need the standard error. How can I calculate the standard error for this OR? I believe that the UNITS or ODDSRATIO statement may be helpful, but I don't know how to do it (https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_logistic_syntax36.htm&docsetVersi...).

It would be great if someone can help me!

 

 

* Example (real dataset is much longer);
DATA dataset;
	INPUT case matchgroup substance1 substance1_2 substance1_3;
	DATALINES;
	1 1 2 4 8
	0 2 5 25 125
	0 3 10 100 1000
	1 4 20 400 8000
	0 1 15 225 3375
	0 2	8	64	512
	0 3	3	9	27
	0 4	17	289	4913
	1 1	12	144	1728
RUN;


title Univariate logistic regression on dataset - substance1_2 substance1_3;
proc logistic data=dataset outest=betas_substance1;
  		strata matchgroup;
       	model case(event='1')= substance1_2 substance1_3 / alpha=0.1;
run;

* Intermediate step: Regression coefficients in output betas_substance1 were renamed to beta_substance1_2 and beta_substance1_3
....;

DATA dataset;
	SET dataset;

	* log odds and odds ratio;
	log_odds_substance1 = beta_substance1_2*(15**2-5**2) + beta_substance1_3*(15**3-5**3);
	OR_substance1 = exp(log_odds_substance1);

	* 90% CI;
	Standard_error_substance1 = ????;
	LCI_OR_substance1 = exp(log_odds_substance1 - Standard_error_substance1*1.645);
	UCI_OR_substance1 = exp(log_odds_substance1 + Standard_error_substance1*1.645);
RUN;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

These references, which might help:

 

Estimating the odds ratio for X in a logistic model containing a polynomial or spline of X

Estimating an odds ratio for a variable involved in an interaction

 

With respect to your conjecture that you ought to be able to use the UNITS statement to specify the difference between 5 and 10, here is some UNTESTED code that you might try to modify. The model does not converge on your small sample data. I tried adding a few more observations, but finally gave up. Maybe someone can use this as a starting point for discussion.

 

DATA dataset;
	INPUT Y matchgroup substance1;
   x = substance1;
   substance1_2 = substance1**2;
   substance1_3 = substance1**3;
	DATALINES;
	0 1 2
	0 2 5
	0 3 10
	1 4 20
   1 5 15
   1 6 11
   0 7 8
	0 1 3
	1 2 8
	1 3 18
	0 4 15
   1 5 16
   1 6 13
   1 7 11
;

/* UNTESTED */
title Univariate logistic regression on dataset - substance1_2 substance1_3;
proc logistic data=dataset outest=betas_substance1;
   strata matchgroup;
   effect poly = polynomial(x / degree=3);
   model Y(event='1')= poly / alpha=0.1;
   oddsratio x / at(x=5);
   units x = 10;
run;

 

 

 

View solution in original post

9 REPLIES 9
PaigeMiller
Diamond | Level 26

According to the PROC LOGISTIC documentation

 

The CLODDS= option in the MODEL statement of PROC LOGISTIC is what you want

 

Capture.PNG

 

--
Paige Miller
Danaus
Calcite | Level 5

Thank you. However, it says that the CLODDS= option does not work with the STRATA Statement, and I need the STRATA statement in my regression procedure (since it is a matched case-control study). Any other idea?

Rick_SAS
SAS Super FREQ

I think you misread the doc. It says that the CLODDS=PL option is not supported when you use the STRATA statement, but the CLODDS=WALD option is supported and generates the CIs.

 

Danaus
Calcite | Level 5

Thank you, you're right.

However, using CLODDS does not solve the problem, or I don't know how to do it (see what I did below). I get odds ratios for substance1_2 and substance1_3.

But what I am looking for is the odds ratio of substance1 (not _2 or _3) for the difference 15 to 5 (I already did that, see my first post), and I need to calculate the 90% CI for this odds ratio (for which I need the standard error). Will the covariance help to find the standard error? If so, how would I go about it (I just know that you can output it with covout)?

I appreciate any help!

 

title Univariate logistic regression on dataset - substance1_2 substance1_3;
proc logistic data=dataset outest=betas_substance1;
  	strata matchgroup;
       	model case(event='1')= substance1_2 substance1_3 / clodds = wald alpha=0.1;
run;

 

 

PaigeMiller
Diamond | Level 26

Then you have the wrong model. If you want information about substance_1 and not about substance1_2, you need to redefine the model and then the CLODDS= does give you what you want.

--
Paige Miller
Danaus
Calcite | Level 5

Thanks for your answer.
I'm afraid that I cannot phrase my question statistically clearly. I'll give it another try:

I calculated ONE odds ratio for the function "beta2*substance1_2  + beta3*substance1_3" and need the corresponding 90% CI. I want to know how much higher is the odds to be a case for a unit of 15 compared to a unit of 5 (in the untransformed variable substance1) if the function that describes the relationship between substance1 and being a case is not a straight line, namely beta2*substance1²  + beta3*substance1³.

It would be great to hear your ideas.

 

 

Rick_SAS
SAS Super FREQ

These references, which might help:

 

Estimating the odds ratio for X in a logistic model containing a polynomial or spline of X

Estimating an odds ratio for a variable involved in an interaction

 

With respect to your conjecture that you ought to be able to use the UNITS statement to specify the difference between 5 and 10, here is some UNTESTED code that you might try to modify. The model does not converge on your small sample data. I tried adding a few more observations, but finally gave up. Maybe someone can use this as a starting point for discussion.

 

DATA dataset;
	INPUT Y matchgroup substance1;
   x = substance1;
   substance1_2 = substance1**2;
   substance1_3 = substance1**3;
	DATALINES;
	0 1 2
	0 2 5
	0 3 10
	1 4 20
   1 5 15
   1 6 11
   0 7 8
	0 1 3
	1 2 8
	1 3 18
	0 4 15
   1 5 16
   1 6 13
   1 7 11
;

/* UNTESTED */
title Univariate logistic regression on dataset - substance1_2 substance1_3;
proc logistic data=dataset outest=betas_substance1;
   strata matchgroup;
   effect poly = polynomial(x / degree=3);
   model Y(event='1')= poly / alpha=0.1;
   oddsratio x / at(x=5);
   units x = 10;
run;

 

 

 

Danaus
Calcite | Level 5

Thank you very much! I find your post a very useful starting point.

 

Your suggestion with

 effect poly = polynomial(x / degree=3);

works well if the model is

 

 model Y(event='1')= substance1 substance1*substance1 substance1*substance1*substance;

My model is different, though, and in fact, I also have other models which include, e.g., the log-transformation.

 

I think you reference  http://support.sas.com/kb/35/189.html with the code

      proc logistic;
         model y = x x*x;
         contrast 'Log OddsRatio for X' x 1 x*x 7 / estimate=exp;
         estimate 'Log OddsRatio for X' x 1 x*x 7 / exp cl;
       run;

may be useful there. Do you think it will work for different types of transformations in the same model (e.g. ³ and log-transformation)?

If I can find the solution, I'll post it.

Danaus
Calcite | Level 5

The code you can find here did the trick  http://support.sas.com/kb/35/189.html . It works for different transformations. Thank you!

      proc logistic;
         model y = x x*x;
         contrast 'Log OddsRatio for X' x 1 x*x 7 / estimate=exp;
         estimate 'Log OddsRatio for X' x 1 x*x 7 / exp cl;
       RUN; 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 9 replies
  • 1418 views
  • 1 like
  • 3 in conversation