options pageno=1 linesize=80;
goptions reset=all;
title "Model for digestive process in striped bass";
title2 "Wetzel and Kohler unpublished data";
data fishguts;
input weight time;
datalines;
1.000 0.0
0.965 0.5
0.723 3.0
0.458 5.5
0.245 8.0
0.095 10.5
0.065 13.0
0.030 15.5
0.012 18.0
0.008 20.5
0.000 23.0
;
run;
* Print data set;
proc print data=fishguts;
run;
* Sort x-axis data for plots;
proc sort data=fishguts;
by time;
run;
* Plot data and fit smooth line;
proc gplot data=fishguts;
plot weight*time;
symbol1 i=sm50 v=star;
run;
* Nonlinear regression using joined linear + exponential model;
proc nlin data=fishguts;
* Models are joined at time = theta;
if time<theta then
model weight=1+b*time; * Linear part of model;
else
model weight=(1+b*theta)*exp(d*(time-theta)); * Exponential part;
* Initial guesses for parameter values;
parms b=-0.15 to -0.05 by 0.02 theta=10 d=-0.30 to -0.10 by 0.02;
* Boundaries for model parameters;
bounds b d < 0;
bounds theta >= 0;
output out=resids p=pred r=resid;
run;
* Print data, fitted values, and residuls;
proc print data=resids;
run;
* Plot data and fitted model;
proc gplot data=resids;
plot weight*time=1 pred*time=2 / overlay;
symbol1 i=none v=star c=black;
symbol2 i=j v=none c=blue;
run;
goptions reset=all;
title "Diagnostic plots for nonlinear regression assumptions";
* Plot residuals vs. predicted values;
proc gplot data=resids;
plot resid*pred;
run;
* Normal quantile plot of residuals;
proc univariate noprint data=resids;
qqplot resid / normal;
run;
quit; Greeting All I am trying to use nonlinear regression segmented linear models for the Day with temp and RH I have this example and I need help to make it fit to my data to predict the Day My Data is RH temp Day 94 10 65 62 26 11 75 22 13 93 10 51 62 25 10 75 22 14 94 10 70 62 26 10 75 22 14 93 9 78 62 26 11 75 22 11 95 27 14 75 30 8 80 24 8 95 27 13 75 30 6 80 24 8 94 27 12 75 30 7 80 24 6 95 27 14
... View more