I am trying to reproduce the results in Tables 4.1 and 4.3 in Hoffman's (2015) book, Longitudinal Analysis. Her own Stata code (and output) for Chapter 4 can be viewed here, and the data file can be obtained here. The following comment is prominent in her code:
I believe that one of the models Hoffman could not estimate using Stata is the Compound Symmetry Heterogeneous (CSH) model.
I am able to reproduce the R and RCORR matrices for Hoffman's simple CS model using this code:
On another page, Hoffman shows this SPSS code to estimate the CSH model she wants:
That example, and the following excerpt from the documentation for MIXED (see p. 8) make me wonder if there is a way to estimate the CSH model using by(varname).
I wondered if something like this would give me the CSH model:
But when I execute that code, I see this initial bit of output:
But then the wheels just keep spinning for so long that it seems to me something must be wrong.
It is entirely possible that I am not using by(varname) correctly. But thus far, I have been unable to find any worked examples (in the documentation or elsewhere) demonstrating its use. Any pointers would be appreciated, therefore.
I hope I have explained things clearly enough. Thanks for any help you can offer, even if it is only to confirm that Stata's -mixed- command cannot estimate this model.
PS- I suspect the same issue will come up when I get to a heterogeneous Toeplitz covariance structure later in Table 4.1! Here is the SPSS code for that model:
Code:
******* NOTE: NOT ALL MODELS WILL BE POSSIBLE TO ESTIMATE IN STATA *******
I am able to reproduce the R and RCORR matrices for Hoffman's simple CS model using this code:
Code:
* 2. R-only, compound symmetry (CS) -- or exchangeable in Stata!
quietly mixed posmood, ///
|| personid: , noconstant reml covariance(unstructured) ///
residuals(exchangeable,t(studyday))
estimates store CS
estat ic, n(200)
estat wcorrelation, covariance
estat wcorrelation
Code:
ECHO 'Ch 4: Empty Means, Compound Symmetry Heterogeneous R-Only Model'. MIXED posmood BY PersonID studyday /METHOD = REML /PRINT = SOLUTION TESTCOV R /FIXED = /REPEATED = studyday | COVTYPE(CSH) SUBJECT(PersonID).
resopts are by(varname) and t(varname).
by(varname) is for use within the residuals() option and specifies that a set of distinct
residual-error parameters be estimated for each level of varname. In other words, you use
by() to model heteroskedasticity.
by(varname) is for use within the residuals() option and specifies that a set of distinct
residual-error parameters be estimated for each level of varname. In other words, you use
by() to model heteroskedasticity.
Code:
* 3. Compound symmetry heterogeneous (CSH) mixed posmood, /// || personid: , noconstant reml covariance(unstructured) /// residuals(exchangeable, t(studyday) by(personid))
Code:
. mixed posmood, /// > || personid: , noconstant variance reml covariance(unstructured) /// > residuals(exchangeable, t(studyday) by(personid)) Note: t() not required for this residual structure; ignored Obtaining starting values by EM ... Performing gradient-based optimization:
It is entirely possible that I am not using by(varname) correctly. But thus far, I have been unable to find any worked examples (in the documentation or elsewhere) demonstrating its use. Any pointers would be appreciated, therefore.
I hope I have explained things clearly enough. Thanks for any help you can offer, even if it is only to confirm that Stata's -mixed- command cannot estimate this model.
PS- I suspect the same issue will come up when I get to a heterogeneous Toeplitz covariance structure later in Table 4.1! Here is the SPSS code for that model:
Code:
ECHO 'Ch 4: Empty Means, n-1 Lag Toeplitz Heterogeneous R-Only Model'.
MIXED posmood BY PersonID studyday
/METHOD = REML
/PRINT = SOLUTION TESTCOV R
/FIXED =
/REPEATED = studyday | COVTYPE(TPH) SUBJECT(PersonID).
Comment