Discussion:
Estimate odds ratio in proc NLMIXED
(too old to reply)
adel F.
2005-01-28 09:30:40 UTC
Permalink
Hello,
Could you please advise how to estimate odds ratio in proc NLMIXED for binary variables (dependent and independents)
Thanks
Adel


---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail
Robin High
2005-01-29 20:58:09 UTC
Permalink
Post by adel F.
Could you please advise how to estimate odds ratio in proc NLMIXED for
binary variables (dependent and independents)
Adel

For a design with two independent groups (treatment and control) one way
is with the output delivery system as shown below:

ODS OUTPUT ParameterEstimates=est;

PROC NLMIXED DATA=infection;
PARMS beta0=-0.7 beta1=0.4;
eta = beta0 + beta1*trt;
expeta = exp(eta);
p = expeta/(1+expeta);
MODEL y ~ binomial(n,p);
TITLE1 "NLMIXED: Logistic Regression Results";
RUN;

DATA od_rat; SET est;
IF parameter='beta1' then DO; odd_ratio =exp(estimate); output; end;

proc print data=od_rat; run;

Robin High
Univ. of Oregon
Dale McLerran
2005-01-29 22:40:01 UTC
Permalink
Post by Robin High
Post by adel F.
Could you please advise how to estimate odds ratio in proc NLMIXED
for
Post by adel F.
binary variables (dependent and independents)
Adel
For a design with two independent groups (treatment and control) one way
ODS OUTPUT ParameterEstimates=est;
PROC NLMIXED DATA=infection;
PARMS beta0=-0.7 beta1=0.4;
eta = beta0 + beta1*trt;
expeta = exp(eta);
p = expeta/(1+expeta);
MODEL y ~ binomial(n,p);
TITLE1 "NLMIXED: Logistic Regression Results";
RUN;
DATA od_rat; SET est;
IF parameter='beta1' then DO; odd_ratio =exp(estimate); output; end;
proc print data=od_rat; run;
Yes, this will do the job. However, why not let NLMIXED return
the estimate for you? The estimate statement in NLMIXED allows
estimation not only of linear combinations of parameters, but
also nonlinear combinations of parameters. So, we can simply
write

PROC NLMIXED DATA=infection;
PARMS beta0=-0.7 beta1=0.4;
eta = beta0 + beta1*trt;
expeta = exp(eta);
p = expeta/(1+expeta);
MODEL y ~ binomial(n,p);
ESTIMATE "Treatment Odds Ratio" exp(beta1);
TITLE1 "NLMIXED: Logistic Regression Results";
RUN;


Dale


=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: ***@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------



__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
adel F.
2005-01-30 12:55:40 UTC
Permalink
Thanks Dale,
I agree with you, but one have to be carefull when for the interpretation of the test, the test use
exp(beta1)=0 , and for the odds ratio we are more interested in exp(beta1)=1, the we have to use the confidence interval

I have run a programme for the NLMIXED and I got at the end the variance for u negative, and there was no convergence the QUANEW did not converge, whcih is the most simple technique and method which allow a convergence
I use TECH=NONE METHOD=ISAMP QPOINTS=4 GCONV=1e-6

As simples option in order to have convergence

Could you please advise on this

Many thanks
Adel
Post by Robin High
Post by adel F.
Could you please advise how to estimate odds ratio in proc NLMIXED
for
Post by adel F.
binary variables (dependent and independents)
Adel
For a design with two independent groups (treatment and control) one way
ODS OUTPUT ParameterEstimates=est;
PROC NLMIXED DATA=infection;
PARMS beta0=-0.7 beta1=0.4;
eta = beta0 + beta1*trt;
expeta = exp(eta);
p = expeta/(1+expeta);
MODEL y ~ binomial(n,p);
TITLE1 "NLMIXED: Logistic Regression Results";
RUN;
DATA od_rat; SET est;
IF parameter='beta1' then DO; odd_ratio =exp(estimate); output; end;
proc print data=od_rat; run;
Yes, this will do the job. However, why not let NLMIXED return
the estimate for you? The estimate statement in NLMIXED allows
estimation not only of linear combinations of parameters, but
also nonlinear combinations of parameters. So, we can simply
write

PROC NLMIXED DATA=infection;
PARMS beta0=-0.7 beta1=0.4;
eta = beta0 + beta1*trt;
expeta = exp(eta);
p = expeta/(1+expeta);
MODEL y ~ binomial(n,p);
ESTIMATE "Treatment Odds Ratio" exp(beta1);
TITLE1 "NLMIXED: Logistic Regression Results";
RUN;


Dale


=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: ***@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------



__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com


---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail
Dale McLerran
2005-01-30 14:33:54 UTC
Permalink
Adel,

You are correct that the test of exp(beta1)=0 is almost surely
non=informative, and that we really are interested in the test
of exp(beta1)=1. But we really don't need a test for the odds
ratio since we have an equivalent test (H0: beta1=0) for the
log odds.

You indicate that the variance estimate for your random effect
is going negative and you are not getting convergence. A
reparameterization of your variance estimation process can be
a big help in such situations. In place of the RANDOM statement

random u ~ normal(0, s2u) subject=region;

try fitting the model with

random u ~ normal(0, exp(2*LogSDu)) subject=region;

Since exp(x)>0, the reparameterization will avoid a negative
variance estimate. Note that you can obtain an estimate of the
variance in NLMIXED through an estimate statement - just as you
obtain an estimate of the odds ratio through an estimate statement.
Thus, you can code

estimate "Variance(u)" exp(2*LogSDu);

Dale
Post by adel F.
Thanks Dale,
I agree with you, but one have to be carefull when for the
interpretation of the test, the test use
exp(beta1)=0 , and for the odds ratio we are more interested in
exp(beta1)=1, the we have to use the confidence interval
I have run a programme for the NLMIXED and I got at the end the
variance for u negative, and there was no convergence the QUANEW did
not converge, whcih is the most simple technique and method which
allow a convergence
I use TECH=NONE METHOD=ISAMP QPOINTS=4 GCONV=1e-6
As simples option in order to have convergence
Could you please advise on this
Many thanks
Adel
=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: ***@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------



__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250
adel F.
2005-01-30 19:15:55 UTC
Permalink
Hi Dale,
Sorry I did not see your present email, I agree with you, we do not need a test for the odds ratio, since we have already a test for the parameter, but let me ask you what is the quantity LogSDu, it is the log of the parameter s2u, that I consider in starting parameter?
Thanks
Adel

Dale McLerran <***@yahoo.com> wrote:
Adel,

You are correct that the test of exp(beta1)=0 is almost surely
non=informative, and that we really are interested in the test
of exp(beta1)=1. But we really don't need a test for the odds
ratio since we have an equivalent test (H0: beta1=0) for the
log odds.

You indicate that the variance estimate for your random effect
is going negative and you are not getting convergence. A
reparameterization of your variance estimation process can be
a big help in such situations. In place of the RANDOM statement

random u ~ normal(0, s2u) subject=region;

try fitting the model with

random u ~ normal(0, exp(2*LogSDu)) subject=region;

Since exp(x)>0, the reparameterization will avoid a negative
variance estimate. Note that you can obtain an estimate of the
variance in NLMIXED through an estimate statement - just as you
obtain an estimate of the odds ratio through an estimate statement.
Thus, you can code

estimate "Variance(u)" exp(2*LogSDu);

Dale
Post by adel F.
Thanks Dale,
I agree with you, but one have to be carefull when for the
interpretation of the test, the test use
exp(beta1)=0 , and for the odds ratio we are more interested in
exp(beta1)=1, the we have to use the confidence interval
I have run a programme for the NLMIXED and I got at the end the
variance for u negative, and there was no convergence the QUANEW did
not converge, whcih is the most simple technique and method which
allow a convergence
I use TECH=NONE METHOD=ISAMP QPOINTS=4 GCONV=1e-6
As simples option in order to have convergence
Could you please advise on this
Many thanks
Adel
=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: ***@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------



__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250


---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail
Dale McLerran
2005-01-31 03:02:53 UTC
Permalink
Adel,

LogSDu is the log of the square root of your parameter s2u. For
a single random effect, you could parameterize the model in terms
LogS2U and convergence would be obtained just as easily. But if
you have two or more random effects which have a nonzero covariance
structure, then it is better to parameterize the model as I
indicated previously. The reason is that the random effect
covariance structure can then be expressed as

_ _
cov(u1, u2) = | exp(2*LogSDu1) rho*exp(LogSDu1 + LogSDu2) |
| rho*exp(LogSDu1 + LogSDu2) exp(2*LogSDu2) |

- -


We can also reparameterize the correlation employing the functional
relationship Z = 0.5*log((1 + rho) / (1 - rho)). Note that this
is the Fisher Z statistic. For rho from -1 to 1, the Fisher Z
statistic ranges from -infinity to infinity. We can invert the
Fisher Z statistic to get the correlation. When we parameterize
the model in terms of the Fisher Z statistic, then we do not
need to worry about any boundary conditions for the correlation.
The inverse transformation which returns rho from the Fisher Z
statistic is

rho = (exp(2*Z) - 1) / (exp(2*Z) + 1)

That is, you could replace rho in the covariance matrix presented
above by a function of the Fisher Z statistic. Then the estimation
process can operate on an unrestricted parameter space. This can
greatly help the estimation process.

It is for this same reason that we might prefer to work with
reparameterized variance function where the parameter LogSDu
is completely unrestricted, but the function exp(2*LogSDu)
returns a positive variance estimate.

Sorry that I don't have time to go into more details now. You
can look for more of my posts about the NLMIXED procedure in the
SAS-L archives. I have previously posted on these topics.

Dale
Post by adel F.
Hi Dale,
Sorry I did not see your present email, I agree with you, we do not
need a test for the odds ratio, since we have already a test for the
parameter, but let me ask you what is the quantity LogSDu, it is the
log of the parameter s2u, that I consider in starting parameter?
Thanks
Adel
Adel,
You are correct that the test of exp(beta1)=0 is almost surely
non=informative, and that we really are interested in the test
of exp(beta1)=1. But we really don't need a test for the odds
ratio since we have an equivalent test (H0: beta1=0) for the
log odds.
You indicate that the variance estimate for your random effect
is going negative and you are not getting convergence. A
reparameterization of your variance estimation process can be
a big help in such situations. In place of the RANDOM statement
random u ~ normal(0, s2u) subject=region;
try fitting the model with
random u ~ normal(0, exp(2*LogSDu)) subject=region;
Since exp(x)>0, the reparameterization will avoid a negative
variance estimate. Note that you can obtain an estimate of the
variance in NLMIXED through an estimate statement - just as you
obtain an estimate of the odds ratio through an estimate statement.
Thus, you can code
estimate "Variance(u)" exp(2*LogSDu);
Dale
=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: ***@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------



__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
adel F.
2005-01-31 14:01:45 UTC
Permalink
Dear Dale,
Thank you very much for all these very interesting explanations, really appreciate your efforts, this is very helpfull for me

Adel

Dale McLerran <***@YAHOO.COM> wrote:
Adel,

LogSDu is the log of the square root of your parameter s2u. For
a single random effect, you could parameterize the model in terms
LogS2U and convergence would be obtained just as easily. But if
you have two or more random effects which have a nonzero covariance
structure, then it is better to parameterize the model as I
indicated previously. The reason is that the random effect
covariance structure can then be expressed as

_ _
cov(u1, u2) = | exp(2*LogSDu1) rho*exp(LogSDu1 + LogSDu2) |
| rho*exp(LogSDu1 + LogSDu2) exp(2*LogSDu2) |

- -


We can also reparameterize the correlation employing the functional
relationship Z = 0.5*log((1 + rho) / (1 - rho)). Note that this
is the Fisher Z statistic. For rho from -1 to 1, the Fisher Z
statistic ranges from -infinity to infinity. We can invert the
Fisher Z statistic to get the correlation. When we parameterize
the model in terms of the Fisher Z statistic, then we do not
need to worry about any boundary conditions for the correlation.
The inverse transformation which returns rho from the Fisher Z
statistic is

rho = (exp(2*Z) - 1) / (exp(2*Z) + 1)

That is, you could replace rho in the covariance matrix presented
above by a function of the Fisher Z statistic. Then the estimation
process can operate on an unrestricted parameter space. This can
greatly help the estimation process.

It is for this same reason that we might prefer to work with
reparameterized variance function where the parameter LogSDu
is completely unrestricted, but the function exp(2*LogSDu)
returns a positive variance estimate.

Sorry that I don't have time to go into more details now. You
can look for more of my posts about the NLMIXED procedure in the
SAS-L archives. I have previously posted on these topics.

Dale
Post by adel F.
Hi Dale,
Sorry I did not see your present email, I agree with you, we do not
need a test for the odds ratio, since we have already a test for the
parameter, but let me ask you what is the quantity LogSDu, it is the
log of the parameter s2u, that I consider in starting parameter?
Thanks
Adel
Adel,
You are correct that the test of exp(beta1)=0 is almost surely
non=informative, and that we really are interested in the test
of exp(beta1)=1. But we really don't need a test for the odds
ratio since we have an equivalent test (H0: beta1=0) for the
log odds.
You indicate that the variance estimate for your random effect
is going negative and you are not getting convergence. A
reparameterization of your variance estimation process can be
a big help in such situations. In place of the RANDOM statement
random u ~ normal(0, s2u) subject=region;
try fitting the model with
random u ~ normal(0, exp(2*LogSDu)) subject=region;
Since exp(x)>0, the reparameterization will avoid a negative
variance estimate. Note that you can obtain an estimate of the
variance in NLMIXED through an estimate statement - just as you
obtain an estimate of the odds ratio through an estimate statement.
Thus, you can code
estimate "Variance(u)" exp(2*LogSDu);
Dale
=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: ***@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------



__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250


---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail

adel F.
2005-01-30 12:56:45 UTC
Permalink
Thanks Robin
Post by adel F.
Could you please advise how to estimate odds ratio in proc NLMIXED for
binary variables (dependent and independents)
Adel

For a design with two independent groups (treatment and control) one way
is with the output delivery system as shown below:

ODS OUTPUT ParameterEstimates=est;

PROC NLMIXED DATA=infection;
PARMS beta0=-0.7 beta1=0.4;
eta = beta0 + beta1*trt;
expeta = exp(eta);
p = expeta/(1+expeta);
MODEL y ~ binomial(n,p);
TITLE1 "NLMIXED: Logistic Regression Results";
RUN;

DATA od_rat; SET est;
IF parameter='beta1' then DO; odd_ratio =exp(estimate); output; end;

proc print data=od_rat; run;

Robin High
Univ. of Oregon


---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail
Loading...