For instance, if you use the log binomial method for the first example (gender and question) in note 23003, the confidence interval on the relative risk estimate is (1.0365, 2.1707) which is not centered around the relative risk estimate (1.5) and has width 1.1342 as compared to the NLMeans/delta method width 1.1087.
And sorry but I forgot that the NLMeans macro can handle multiple sets of estimates, so it can provide difference or ratio estimates for more than one variable at a time. You can specify more than one variable in the LSMEANS statement (or more than one LSMEANS statement) in the preceding modeling procedure and the macro will, by default (options=nojoint), compute differences or ratios separately for each set of LSMEANS estimates.
oops just saw your second post. let me try that. thank you!
thanks for the quick response.
I think I will just run my model (that has more than one term) with proc logistic and convert odds ratio to relative risk. For models with one term, I will use the NLmeans approach. It would have been nice to use the same approach for models with multiple terms.
I tried a new model with two terms in it.
Please see my code, log, and output for each approach.
Code –
proc genmod data = data descending;
class var_a(ref='0') var_b(ref='0')/param=ref;
model outcome(ref='0') = var_a var_b/ dist = binomial link = log type3;
estimate 'Beta' var_a 1 -1/ exp;
estimate 'Beta' var_b 1 -1/exp;
run;
Log –
NOTE: PROC GENMOD is modeling the probability that outcome='1'.
NOTE: The Pearson chi-square and deviance are not computed since the AGGREGATE option is not
specified.
NOTE: Algorithm converged.
NOTE: The scale parameter was held fixed.
WARNING: More coefficients than levels specified for effect var_a. Some coefficients will be
ignored.
WARNING: More coefficients than levels specified for effect var_b. Some coefficients will be
ignored.
NOTE: PROCEDURE GENMOD used (Total process time):
real time 1.15 seconds
cpu time 0.78 seconds
output -
using nlmeans approach
proc logistic data=data;
class var_a(ref="0") var_b(ref="0")/ param=glm;
model outcome(event="1")=var_a var_b;
lsmeans var_a/ e ilink;
lsmeans var_b/ e ilink;
ods output coef=coeffs;
store out=ques;
run;
%NLMeans(instore=ques, coef=coeffs, link=logit, options=ratio, title=Relative Risk);
Log –
NOTE: PROC LOGISTIC is modeling the probability that outcome='1'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: The LOGISTIC procedure generated the model item store WORK.QUES.
NOTE: The data set WORK.COEFFS has 10 observations and 6 variables.
NOTE: There were 341 observations read from the data set WORK.DATA.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 2.42 seconds
cpu time 1.62 seconds
2633
2634 %NLMeans(instore=ques, coef=coeffs, link=logit, options=ratio, title=Relative Risk);
WARNING: The final Hessian matrix is not positive definite, and therefore the estimated covariance
matrix is not full rank and may be unreliable. The variance of some parameter estimates
is zero or some parameters are linearly related to other parameters.
WARNING: The final Hessian matrix is not positive definite, and therefore the estimated covariance
matrix is not full rank and may be unreliable. The variance of some parameter estimates
is zero or some parameters are linearly related to other parameters.
NOTE: The NLMEANS macro used 3.73 seconds.
output -
I am supposed to write separate LSMEANS statement and one macro statement, right? What am I doing wrong here?
You should specify only as many coefficients for a model effect in the ESTIMATE statement as it has parameter estimates. With reference parameterization (PARAM=REF), a binary variable has only one parameter estimate, so you can specify only one coefficient. If you just change PARAM=REF to PARAM=GLM, then both binary predictors will have two parameter estimates (the last being zero in each case) and your ESTIMATE statements will not produce Warnings - though I think the results will be the same.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.