Hello All,
I am estimating a linear slope, a quadratic slope and an intercept of one specific variable. I want to predict these variables because I want to use them as independent variables in another analysis.
Below is my code for the mixed model. In this code fit is my outcome, cycle is the linear slope, cycle2 is the quadratic slope, and my intercept is a random intercept by ID.
I tried the below code to predict the linear slope, the quadratic slope, and the intercept. But I get an error message (see below).
Since predict refffects is limited to two variables, how can I predict everything I need? Did I misunderstand anything?
Best wishes and thank you for your time.
Patrick
I am estimating a linear slope, a quadratic slope and an intercept of one specific variable. I want to predict these variables because I want to use them as independent variables in another analysis.
Below is my code for the mixed model. In this code fit is my outcome, cycle is the linear slope, cycle2 is the quadratic slope, and my intercept is a random intercept by ID.
Code:
mixed fit cycle cycle2 ///
> || ID: cycle, covariance(uns) variance
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log likelihood = -14436.131
Iteration 1: log likelihood = -14436.131
Computing standard errors:
Mixed-effects ML regression Number of obs = 9,056
Group variable: ID Number of groups = 935
Obs per group:
min = 1
avg = 9.7
max = 15
Wald chi2(2) = 103.19
Log likelihood = -14436.131 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
fit | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
cycle | -.1170634 .0120247 -9.74 0.000 -.1406314 -.0934953
cycle2 | .0054118 .0007144 7.58 0.000 .0040116 .0068119
_cons | 5.792452 .0551227 105.08 0.000 5.684413 5.90049
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
ID: Unstructured |
var(cycle) | .0134116 .001063 .0114819 .0156657
var(_cons) | 1.373924 .0900777 1.208248 1.562318
cov(cycle,_cons) | -.0655636 .0080507 -.0813426 -.0497845
-----------------------------+------------------------------------------------
var(Residual) | 1.016058 .016739 .9837744 1.049402
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 4571.58 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
Code:
predict fit1_slope fit_slope2 fit_int1, reffects too many variables specified you must specify 2 new variable(s) r(103); end of do-file r(103);
Best wishes and thank you for your time.
Patrick

Comment