BookmarkSubscribeRSS Feed
ojibous
Calcite | Level 5

Hello,

 

Please I am trying to run these codes but I'm getting the above errors and do not know what to do. I will appreciate if anyone can help me. Thanks

 

There are 8000 observations. Edema (Yes=1/No=0)

 

proc nlmixed data = rsm1; call streaminit(12345);
parms beta0=1 beta1=1 beta2=1 beta11=1 beta12=1 beta22=1 s2=1;
y2 = (beta0 + beta1*DoseA + beta2*DoseT + beta11*DoseA*DoseA
+ beta22*DoseT*DoseT + beta12*DoseA*DoseT);
p = exp(y2)/(1+exp(y2));
model Edema~binary(p);
predict y2 out=y2;
run;

11 REPLIES 11
PaigeMiller
Diamond | Level 26

Did you look at observation number 2501 to see if there was anything unusual about it?

 

 

 

 

--
Paige Miller
ojibous
Calcite | Level 5

Yes I did that. I don't see anything wrong or unusual. 

ojibous
Calcite | Level 5

I am also trying to see if Proc NLIN can do same thing but with probit; but I am stuck at the model part. Can you help with my codes?

 

proc nlin data =rsm1 method=newton;
parms beta0=1 beta1=1 beta2=1 beta11=1 beta12=1 beta22=1 s2=1;
y2 = (beta0 + beta1*DoseA + beta2*DoseT + beta11*DoseA*DoseA
+ beta22*DoseT*DoseT + beta12*DoseA*DoseT);
p = probnorm(y2);
if (edema = 1) then p = 1-p;
model.edema = p;
output out=p p=predict;
run;

 

PaigeMiller
Diamond | Level 26

I'm not exactly sure what you are doing, but why don't you just use PROC LOGISTIC since you have binary Y variable?

 

But wait, p is not necessarily in the interval [0,1] yet you are using the binary function on it? Could that be the problem?

--
Paige Miller
ojibous
Calcite | Level 5

Thank you for responding Paige. 

 

I would have used PROC logistic but my model is quadratic. I'm not sure if Logistic can do that. 

PROC RSREG would work fine too if my response variable was continuous. But now it is binary. 

 

I am trying to find the combination that will produce the optimum response.

PROC NLMIXED worked perfectly fine when my response was continuous, using the code below. But now I want to do same with a binary response. 

 

proc nlmixed data = rsm1 tech=newrap;
parms beta0=1 beta1=1 beta2=1 beta11=1 beta12=1 beta22=1 s2=1;
y = (beta0 + beta1*DoseA + beta2*DoseT + beta11*DoseA*DoseA
+ beta22*DoseT*DoseT + beta12*DoseA*DoseT);
model cdbp~normal(y,s2);
predict y out=y;
run;

 

Thanks

PaigeMiller
Diamond | Level 26

LOGISTIC can handle interactions and quadratic terms.

--
Paige Miller
ojibous
Calcite | Level 5

Okay. Thank you so much Paige. 

I would try that. It is a good start. 

My end goal is to condition for binary response while maximizing for the continuous response. I think that's what took me to PROC NLIN and NLMIXED. 

PaigeMiller
Diamond | Level 26

@ojibous wrote:

Okay. Thank you so much Paige. 

I would try that. It is a good start. 

My end goal is to condition for binary response while maximizing for the continuous response. I think that's what took me to PROC NLIN and NLMIXED. 


I guess "condition for binary response" and "maximizing the continuous response" doesn't sound like anything I associate with regression techniques (and wait a minute, you have both binary response and continuous response??? This hasn't been mentioned before)

 

Regression techniques try to find a model of the x-variables that is the best predictor of the response. If that's what you want, regression is for you. If you want something else, its not clear to me what you want.

--
Paige Miller
ojibous
Calcite | Level 5

Okay. I'm sorry I think I threw many information without explaining. 

 

This is my task:

1. Find the dose of A & T that has the optimum response of change in blood pressure (cdbp - continuous variable) (which I already did)

2. Find the dose of A & T that that has the highest probability of the side effect: edema.(binary variable) (Where I am presently). 

3. Maximize the change in blood pressure while minimizing the probability of side effect edema. 

In the end I want to produce a surface plot for (1) and (2) and compare them both. 

Or if possible, overlay the surface plots. 

Any advise on SAS procedures valuable will be appreciated. 

PaigeMiller
Diamond | Level 26

@ojibous wrote:

 

2. Find the dose of A & T that that has the highest probability of the side effect: edema.(binary variable) (Where I am presently). 

 


From the logistic regression, you can compute the probability of edema at each level of dose of A & T, then pick the maximum. To get the probabilities of edema at each dose, you use the OUTPUT statement in PROC LOGISTIC. (If you want to examine the output at levels more systematically, you can append extra levels of A and T to your actual data set, with missing Y values, and the OUTPUT statement will still include predictions for all of these extra levels)

 

3. Maximize the change in blood pressure while minimizing the probability of side effect edema. 

In the end I want to produce a surface plot for (1) and (2) and compare them both. 

 

Take the measures of change in BP and probabilities of edema, put them into one data set, and look at them with your own eyeballs to see which has the best BP with the lowest edema, or do some plotting.

 

--
Paige Miller
ojibous
Calcite | Level 5

Thank you Paige. 

That's exactly what I did. Thank you for validating it. 

Thank you for your time too 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 11 replies
  • 1089 views
  • 0 likes
  • 2 in conversation