You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
11 KiB
Plaintext

7 months ago
{smcl}
{* 14may2012}{...}
{cmd:help traj}
{hline}
{p 4 4 6}{hi: traj}: Fit the traj model{p_end}
{p 4 4 6}{hi: {help trajplot}}: Plot the traj model results{p_end}
{marker s_Description}
{title:Description}
{p 4 4 6}
{cmd:traj} uses a discrete mixture model to model longitudinal data. This model allows for data
grouping using different parameter values for each group distribution. Groupings may identify
distinct subpopulations. Alternatively, groupings may represent components approximating an
unknown (possibly complex) data distribution.{p_end}
{hline}
{title:Examples}
1:{help traj##s_1: Censored Normal Model}
2.{help traj##s_2: Zero-Inflated Poisson Model}
3.{help traj##s_3: Logistic Model}
4.{help traj##s_4: Time-Stable Covariates for Group Membership}
5.{help traj##s_5: Group Membership Probabilities from a Model with Time Stable Covariates}
6.{help traj##s_6: Time-Varying Covariates Influencing Trajectory Paths}
7.{help traj##s_7: Start Values}
8.{help traj##s_8: Joint Trajectory Model}
9.{help traj##s_9: Distal Outcome Model}
10.{help traj##s_10: Wald Tests for Hypotheses Based on the Parameter Estimates}
11.{help traj##s_11: Exposure Time / Sample Weights}
12.{help traj##s_12: Dropout Model}
{hline}
{marker s_Syntax}
{title:Syntax}
{p 6 8 6}
{cmdab:traj} [{help if:{it:if}}]{cmd:, var(}{help varlist:{it:varlist}}{cmd:) indep(}{help varlist:{it:varlist}}{cmd:) model(}{it:modeltype}{cmd:) order(}{help numlist:{it:numlist}}{cmd:)} [additional options] {p_end}
{synoptset 20 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Trajectory Variables}
{synopt :{opt var(varlist)}}dependent variables, measured at different times or ages{p_end}
{synopt :{opt indep(varlist)}}independent variables i.e. when the dependant variables were measured{p_end}
{syntab:Model}
{synopt :{opt model(modeltype)}}probability distribution for the dependent variables: {opt cnorm}, {opt zip}, or {opt logit} {p_end}
{synopt :{opt order(numlist)}}polynomial type (0=intercept, 1=linear, 2=quadratic, 3=cubic) for each group trajectory{p_end}
{synopt :{opt min(#)}}minimum value for the censored normal model (required for cnorm){p_end}
{synopt :{opt max(#)}}maximum value for the censored normal model (required for cnorm){p_end}
{synopt :{opt iorder(numlist)}}optional polynomial type (0=intercept, 1=linear, 2=quadratic, 3=cubic) for the zero-inflation of each group{p_end}
{synopt :{opt exposure(varlist)}}optional exposure variables for the zero-inflated Poisson model{p_end}
{synopt :{opt weight(varname)}}optional sampling weight variable{p_end}
{syntab:Time-Stable Covariates for Group Membership}
{synopt :{opt risk(varlist)}}covariates for the probability of group membership{p_end}
{synopt :{opt refgroup(#)}}controls the reference group (default = 1) when the risk option is used{p_end}
{syntab:Time-Varying Covariates for Group Membership}
{synopt :{opt tcov(varlist)}}time-varying covariates for each group trajectory{p_end}
{synopt :{opt plottcov(matrix)}}optional values for plotting trajectories with time-varying covariates{p_end}
{syntab:Dropout Model}
{synopt :{opt dropout(numlist)}}include logistic model of dropout probability per wave with 0 = constant rate,
1 = depends on the previous response, 2 = depends on the two previous responses, for each group{p_end}
{synopt :{opt dcov(varlist)}}optional lagged time-varying covariates for the dropout model{p_end}
{synopt :{opt obsmar(varname)}}optional binary variable to mark which observations are to be included
in the dropout model and those to be treated as missing at random. This variable = 1 for observations to
be treated as data MAR (include completers) and = 0 for observations to be used for the modeled dropout{p_end}
{syntab:Distal Outcome Model}
{synopt :{opt outcome(varname)}}a distal variable to be regressed on the probability of group membership{p_end}
{synopt :{opt omodel(modeltype)}}probability distribution for the outcome variable: {opt normal}, {opt cnorm}, {opt zip}, or {opt logit} {p_end}
{synopt :{opt ocov(varlist)}}optional covariates for the outcome model{p_end}
{syntab:Joint Trajectory Model}
{syntab:The joint trajectory model uses the options shown above with a '2' suffix to specify the second model e.g. {opt model2(modeltype)} etc. See the {help traj##s_8:joint trajectories} example.}
{syntab:Other}
{synopt :{opt start(matrix)}}parameter start values to override default start values{p_end}
{synopt :{opt detail}}show minimization iterations for monitoring model fitting progress{p_end}
{marker s_1}
{title:Example 1: Censored Normal Model}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/montreal_sim.dta, clear"}{p_end}
{p 4 10 8}{stata "traj, model(cnorm) var(qcp*op) indep(age*) order(1 3 2) min(0) max(10)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Age") ytitle("Opposition")"'}{p_end}
{p 4 10 8}{stata `"list _traj_Group - _traj_ProbG3 if _n < 3, ab(12)"'}{p_end}
{marker s_2}
{title:Example 2: Zero-Inflated Poisson Model}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/anag1.dta, clear"}{p_end}
{p 4 10 8}{stata "traj, model(zip) var(y*) indep(t*) order(2 0 2 2)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Scaled Age") ytitle("Annual Conviction Rate") ci"'}{p_end}
{marker s_3}
{title:Example 3: Logistic Model}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/cambrdge.dta, clear"}{p_end}
{p 4 10 8}{stata "traj, model(logit) var(p1-p23) indep(tt1-tt23) order(3 3 3)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Scaled Age") ytitle("Prevalence")"'}{p_end}
{marker s_4}
{title:Example 4: Time-Stable Covariates for Group Membership}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/montreal_sim.dta, clear"}{p_end}
{p 4 10 8}{stata "traj, model(cnorm) var(qcp*op) indep(age*) order(1 3 2) min(0) max(10) risk(scolmer scolper)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Age") ytitle("Opposition")"'}{p_end}
{marker s_5}
{title:Example 5: Group Membership Probabilities from a Model with Time Stable Covariates}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/anag1.dta, clear"}{p_end}
{p 4 10 8}{stata "matrix strt = (-4.57, -7, 5.96, -1.38, -20.5, 25.4, -8.0, -4.37, 5.55, -1.52, -1.7, 0, 0, 0, 0, -1.7, 0, 0, 0, 0, -2.5, 0, 0, 0, 0)"}{p_end}
{p 4 10 8}{stata "traj, model(zip) var(y*) indep(t*) order(0 2 2 2) risk(lowiq crimpar daring pbeh) start(strt)"}{p_end}
{p 4 10 8}{stata "list lowiq - _traj_ProbG4 in 1/6, ab(12)"}{p_end}
{marker s_6}
{title:Example 6: Time-Varying Covariates Influencing Trajectory Paths}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/gang_data_sim.dta, clear"}{p_end}
{p 4 10 8}{stata "matrix tc1 = (0, 0, 0, 0, 0, 0, 0)"}{p_end}
{p 4 10 8}{stata "matrix tc2 = (0, 0, 0, 1, 1, 1, 1)"}{p_end}
{p 4 10 8}{stata "traj, model(zip) var(bat*) indep(t*) tcov(gang*) order(2 2 2 2 2) plottcov(tc1)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Scaled Age") ytitle("Rate")"'}{p_end}
{p 4 10 8}{stata "traj, model(zip) var(bat*) indep(t*) tcov(gang*) order(2 2 2 2 2) plottcov(tc2)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Scaled Age") ytitle("Rate")"'}{p_end}
{marker s_7}
{title:Example 7: Start Values}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/cambrdge.dta, clear"}{p_end}
{p 4 10 8}{stata "matrix strt = ( -4.8, -15.5, 16.2, -4.5, -1.1, -4.5, 5.1, -1.3, 0, -.2, 66, 20, 7, 7 )"}{p_end}
{p 4 10 8}{stata "traj , model(zip) var(x01-x23) indep(tt1-tt23) order(0 2 0 2) iorder(1) start(strt)"}{p_end}
{p 4 10 8}{stata `"trajplot, ytitle("Offense Counts") xtitle("Scaled Age")"'}{p_end}
{marker s_8}
{title:Example 8: Joint Trajectory Model}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/montreal_sim.dta, clear"}{p_end}
{p 4 10 8}{stata "traj , model(cnorm) var(qcp84op qcp88op qcp89op qcp90op qcp91op) indep(age1-age5) order(1 2 2) max(10) var2(qas91det qas92det qas93det qas94det qas95det) indep2(age3-age7) model2(zip) order2(2 2 2 2)"}{p_end}
{p 4 10 8}{stata `"trajplot, ytitle("Opposition") xtitle("Age")"'}{p_end}
{p 4 10 8}{stata `"trajplot, model(2) ytitle("Rate") xtitle("Age")"'}{p_end}
{marker s_9}
{title:Example 9: Distal Outcome Model}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/montreal_sim.dta, clear"}{p_end}
{p 4 10 8}{stata "traj, model(cnorm) max(10) var(qcp84op qcp88op qcp89op qcp90op qcp91op) indep(age1-age5) order(0 2 2) outcome(nbp14) omodel(poisson)"}{p_end}
{p 4 10 8}{stata `"trajplot, ytitle("Opposition") xtitle("Age")"'}{p_end}
{marker s_10}
{title:Example 10: Wald Tests for Hypotheses Based on the Parameter Estimates}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/anag1.dta, clear"}{p_end}
{p 4 10 8}{stata "matrix strt = (-4.57, -7, 5.96, -1.38, -20.5, 25.4, -8.0, -4.37, 5.55, -1.52, -1.7, 0, 0, 0, 0, -1.7, 0, 0, 0, 0, -2.5, 0, 0, 0, 0)"}{p_end}
{p 4 10 8}{stata "traj, model(zip) var(y*) indep(t*) order(0 2 2 2) risk(lowiq crimpar daring pbeh) start(strt)"}{p_end}
{p 4 10 8}{stata "trajplot, ci"}{p_end}
{p 4 10 8}{stata "testnl _b[lowiq2] = _b[lowiq3] = _b[lowiq4]"}{p_end}
{marker s_11}
{title:Example 11: Exposure Time / Sample Weights}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/weight_expos_sim.dta, clear"}{p_end}
{p 4 10 8}{stata "traj, model(zip) var(g2 - g13) indep(t*) order(2 2) iorder(0 2) expos(e*) weight(wt50)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Age") ytitle("Annual Arrest Rate")"'}{p_end}
{marker s_12}
{title:Example 12: Dropout Model}
{p 4 10 8}{stata "use http://www.andrew.cmu.edu/user/bjones/traj/data/panss.dta, clear"}{p_end}
{p 4 10 8}{stata "traj, var(p1-p6) indep(t1-t6) model(cnorm) min(-999) max(999) order(3 3 0) risk(risper) dropout(2 2 2) dcov(risper risper risper risper risper risper)"}{p_end}
{p 4 10 8}{stata `"trajplot, xtitle("Time (weeks)") ytitle("PANSS") ci"'}{p_end}
{p 4 10 8}{stata `"trajplot, dropout xtitle("Time (weeks)") ytitle("Dropout probability")"'}{p_end}
{title:Author}
{p 4 4 6}Bobby L. Jones{p_end}
{p 4 4 6}bjones@andrew.cmu.edu{p_end}
{p 4 4 6}based on work with Daniel S. Nagin.{p_end}
{title:Web-page}
{p 4 4 6}http://www.andrew.cmu.edu/user/bjones/{p_end}
{title:References}
{p 4 4 6}Jones BL, Nagin DS, Roeder K. 2001. A SAS procedure based on mixture models for estimating developmental trajectories. Sociological Methods & Research 29:374-393{p_end}
{p 4 4 6}Jones BL, Nagin DS. 2007. Advances in group-based trajectory modeling and an SAS procedure for estimating them. Sociological Methods & Research 35:542-571{p_end}
{p 4 4 6}Nagin D. 2005. Group-Based Modeling of Development. Cambridge, MA: Harvard Univ. Press{p_end}
{smcl}