I've been told I need to have just the fitted curve and confidence interval in my graphic, not all the data points. I have literally no idea how to do it.
This is my code to make the predicted probablity graphic, and it's attached as a pdf.
proc glm data=teen.obdata;
weight p_teenpreg;
model p_adverse=minroadmiles miles_sq rural rural*miles_sq;
store intmodel;
run;
quit;
proc plm source=intmodel;
score data=teen.obdata out=_temp1_ predicted / ilink;
run;
ods listing gpath="\\Mac\Home\Desktop";
ods graphics / imagename="small" imagefmt=png;
proc sgplot data = _temp1_;
series x = minroadmiles y = predicted / group = rural;
yaxis label = "Predicted Probability of Adverse Birth Outcomes";
xaxis values= (0 5 10 15 20 25 30 35 40) label = "Miles";
title “Predicted Probability by Road Miles”;
run;
title;
ods graphics off;
Can you post the output of "proc contents data=_temp1_; run;"?
attached!
The problem is that your model has covariates, so plotting the predicted values against one of the covariates (minroadmiles) does not result in a smooth curve. You can use the EFFECTPLOT statement in PROC PLM to produce a sliced fit plot, which enables you to visualize a slice through the regression surface. For more discussion and examples, see Visualize multivariate regression models by slicing continuous variables.
Also see, "3 ways to add confidence limits to regression curves in SAS."
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.