Hi all, To assess the dose-response relation and evaluate the shape of the lactation per child and weight change relation I am using generalized least squares regression and fitted cubic splines with knots at the 5th, 35th, 50th, 65th, and 95th percentile of lactation per child distribution (corresponding to 2, 3, 5, 7, and 10 months). I am adjusting for age, weight at 18 years, educational level, socioeconomic status, age at menarche, age at first pregnancy, average gestational weight change, dietary pattern, physical activity and smoking status. Below the code that I am using, the issue is that I am supposed to get a graph like the one at the left side and I am getting the one that it is on your right side. Do you have any idea what it is happening? Thank you in advance, Monica ods select ANOVA ParameterEstimates SplineKnots;
proc glmselect data=merged0811dersesdiet;
effect spl = spline(lactationbypar / details naturalcubic basis=tpf(noint)
knotmethod=percentiles(5) );
model weightchange2 = spl age ep28e1c1 ep12 ep14 educatlevelm_2 educatlevelm_3 educatlevelm_9 SESM_1 SESM_2 SESM_9 gwgaverage factor1 factor2 factor3 totmet08 smkm_2 smkm_3 smkm_9/ selection=none; /* fit model by using spline effects */
output out=SplineOut predicted=Fit; /* output predicted values for graphing */
quit;
title "Restricted Cubic Spline Regression";
proc sgplot data=SplineOut noautolegend;
series x=lactationbypar y=Fit / lineattrs=(thickness=3 color=red);
run;
... View more