I have longitudinal data and want to examine inter-individual differences in the within functional form.
SAS has a spaghetti plot function with splines, but Stata’s spagplot does not appear to accommodate nonlinear fits.
Thus, I have used the separate command in Stata so as to use the twoway (qfit) command, plotting individuals lines with ||. Data is in long format, but the separate command creates a quasi-wide dataset to use with twoway.
What I am looking for is a loop command to shorten the script, as it is quite long with several individuals in the data set. Imagine the current script looks something like this – – with the exception that instead of scatter, I am using qfit;
graph twoway (scatter tol9 age, msym(i) connect(L)) || (scatter tol45 age, msym(i) connect(L)) || (scatter tol268 age, msym(i) connect(L)) || (scatter tol314 age, msym(i) connect(L)) || (scatter tol442 age, msym(i) connect(L)) || (scatter tol514 age, msym(i) connect(L)) || (scatter tol569 age, msym(i) connect(L)) || (scatter tol624 age, msym(i) connect(L)) || (scatter tol723 age, msym(i) connect(L)) || (scatter tol918 age, msym(i) connect(L)) || (scatter tol949 age, msym(i) connect(L)) || (scatter tol978 age, msym(i) connect(L)) || (scatter tol1105 age, msym(i) connect(L)) || (scatter tol1542 age, msym(i) connect(L)) || (scatter tol1552 age, msym(i) connect(L)) || (scatter tol1653 age, msym(i) connect(L)) || (qfit tol age, lwidth(thick))
Any suggestions on how to use a looping command to mimic the spaghetti pot with non-linear fit in SAS would be greatly appreciated.
Related Posts with Combining several smoothed plots into one pane
replacing missing valuesHello, I have two variables, one is a code identifier for companies (permno), and another is return…
Fama FrenchA new day a new question. I have now done a rolling window regression according to CAPM model and th…
The overall age-standardised rate (ASR) with 95% CIHello, I used the STATA code to calculate age-standardised rate (ASR), but it did not give me the o…
regressionsHello, I have daily stock returns for the market and for companies. I want to run this model (reg r…
ARDL - SR and LR ElasticitiesDear Stata Users, I have been trying to run an ARDL specification to get short and long-run price e…
Subscribe to:
Post Comments (Atom)
0 Response to Combining several smoothed plots into one pane
Post a Comment