How can I get the odds ratio and 95% confidence interval from mixed effect logistic regression in sas?
I am aware that odds ration could be derived by exponentiating the obtained estimate.
A sample dataset and code (derived from a prior post)
data herd;
call streaminit(1);
do herd = 1 to 10;
do testyear = 2005, 2015;
do Time = 1 to 6;
eta = -1 + 0.1*herd + 0.5*Time - 2*(testyear=2015);
mu = logistic(eta);
mpd = rand("Bernoulli", mu);
output;
end;
end;
end;
proc GLIMMIX data = herd;
class testyear TIME;
model MPD = TESTYEAR TIME / s dist=binary;
RANDOM HERD;
RUN;
Appreciate any advice.
/* You could get CI of estimated parameter, and EXP() this CI to get CI of ODDS Rario. */ data herd; call streaminit(1); do herd = 1 to 10; do testyear = 2005, 2015; do Time = 1 to 6; eta = -1 + 0.1*herd + 0.5*Time - 2*(testyear=2015); mu = logistic(eta); mpd = rand("Bernoulli", mu); output; end; end; end; run; ods output ParameterEstimates=ParameterEstimates SolutionR=SolutionR; proc GLIMMIX data = herd; class HERD testyear TIME; model MPD = TESTYEAR TIME / s dist=binary cl ODDSRATIO; RANDOM intercept /cl subject=HERD; RUN; data fixed; set ParameterEstimates; odds_ratio=exp(Estimate); lower_odds_ratio=exp(Lower); upper_odds_ratio=exp(Upper); run; proc print label;run; data mixed; set SolutionR; odds_ratio=exp(Estimate); lower_odds_ratio=exp(Lower); upper_odds_ratio=exp(Upper); run; proc print label;run;
/* You could get CI of estimated parameter, and EXP() this CI to get CI of ODDS Rario. */ data herd; call streaminit(1); do herd = 1 to 10; do testyear = 2005, 2015; do Time = 1 to 6; eta = -1 + 0.1*herd + 0.5*Time - 2*(testyear=2015); mu = logistic(eta); mpd = rand("Bernoulli", mu); output; end; end; end; run; ods output ParameterEstimates=ParameterEstimates SolutionR=SolutionR; proc GLIMMIX data = herd; class HERD testyear TIME; model MPD = TESTYEAR TIME / s dist=binary cl ODDSRATIO; RANDOM intercept /cl subject=HERD; RUN; data fixed; set ParameterEstimates; odds_ratio=exp(Estimate); lower_odds_ratio=exp(Lower); upper_odds_ratio=exp(Upper); run; proc print label;run; data mixed; set SolutionR; odds_ratio=exp(Estimate); lower_odds_ratio=exp(Lower); upper_odds_ratio=exp(Upper); run; proc print label;run;
The two syntax's should give you the same results. However, for complex designs, the use of the intercept/subject= syntax improves convergence. See this paper:
https://support.sas.com/resources/papers/proceedings15/SAS1919-2015.pdf
SteveDenham
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.