i using sas's adaptivereg procedure create piece-wise linear function temperature (temp) x variable , usage (usage_value) y variable. can use details of adaptivereg procedure find ranges of different linear functions of piece-wise function. there way can limit number of ranges, (i.e. instead of having 8 linear functions in piece-wise function, want limit 5 linear functions). there options can add let me limit amount of linear functions?
below code using. a1 name of data set, temp independent variable, , usage_value dependent variable.
proc adaptivereg data=a1 plots=all details=bases; model usage_value = temp; run;
i love adaptivereg. it's such cool little procedure.
you can use df
option in model
statement control total number of knots consider, , maxbasis
option control maximum number of knots in final model. higher degrees of freedom use, fewer knots.
proc adaptivereg data=sashelp.air; model air = date / df=12 maxbasis=3; run;
you can use alpha=
option fine-tune it. increasing alpha result in more knots.
an alternative approach can using pbspline
/spline
options in transreg
or proc quantreg
, respectively.
proc transreg data=sashelp.air; model identity(air) = pbspline(date / evenly=6); run; proc quantreg data=sashelp.air; effect sp = spline(date / knotmethod=equal(12) ); model air = sp / quantile=0.5; run;
Comments
Post a Comment