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
Problem with merge poly in US countiesDear All, I need to merge US counties in larger units. I manually checked that all the counties I w…
PPMLHDFE useHello everybody, I am studying the impact of infrastructure on horticultural trade using a gravity …
How to remove the graph background line?Hello, Good afternoon. I would like to look for some help: 1) I have no idea how to remove the backg…
Plot regressionHi all, After performing this regression: Code: reg loglprice c.yearquarter I would like to vis…
Marginal Effect for Bivariate Probit RegressionDear Statalist, I have question related to the calculation of marginal effects in a bivariate probi…
Subscribe to:
Post Comments (Atom)
0 Response to Combining several smoothed plots into one pane
Post a Comment