Can you help how to write the design matrix to a SAS data set using proc transreg to obtain a basis spline function and also how to specify an interaction between spline(x) and a variable?
If you are willing to use PROC GLMSELECT instead of TRANSREG, see
https://blogs.sas.com/content/iml/2020/06/08/interactions-spline-regression.html
I don't know what "get the weighting function" means. If you post some example data and state what you are hoping to get, that would be helpful.
You still haven't posted data. From what you've said, it sounds like you want to run a two-step process. First, model the weights and score that model at the time points in your data. Then, run the regression and use the WEIGHT statement to use the weights from the first step.
Happy New Year Rick, find below sample data - for each ID, the exposure time points and dose in the last 5 years -
data have;
input ID exposure_time_yr dose $;
cards;
1 0.1 15
1 0.4 7.5
1 1.9 10
1 2 100
1 3.1 100
1 3.8 10
1 3.9 140
1 4.1 140
1 4.8 50
2 0.1 75
2 0.5 150
2 0.2 75
2 0.2 50
2 0.3 75
2 0.3 150
2 0.4 25
2 0.5 225
2 1 25
2 3.5 200
2 4.5 200
3 0.4 5
3 1.5 20
3 2.1 25
3 3 200
3 4.9 100
;
1. Why is dose a character variable? I'll assume that is a mistake.
2. How are you using the ID variable in the model?
3. Where is the weighting variable?
I still don't know what you are trying to accomplish. Can you sketch what you want? Are we supposed to be fitting some line or curves to the following scatter plot?
proc sgplot data=have;
scatter y=exposure_time_yr x=dose / group=ID markerattrs=(symbol=CircleFilled size=12);
run;
Yes, the dose is not a character!
As mentioned in the previous threads, I wanted the weighted sum of pas does over a 5-year window - the data shows the dose exposure and time points over 5 year for each ID. Weights, will be modeled with cubic regression B-splines. I.e., the spline basis functions will represent the weighting function.
* the weighted sum of past doses over a 5-year window
Sorry, but I do not understand. Do you have a reference (textbook? journal article?) that provides details?
I am giving up. Perhaps someone else will be able to help you. Good luck.
Define what you mean by "weights." Look at examples of the WEIGHT statement in regression procs. Is that what you mean? Or do you mean regression coefficients? The TRANSREG documentation has examples of scoring as do many other procedures.
In the paper mentioned above, " the weight function assigns the differential importance weights to past doses, depending on the time elapsed since the dose was taken" - weighted according to their relative proximity in time.
Thanks Rick, here is the link for the paper that I am referring to :
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.