Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Exercise 7.10 in Multilevel and Longitudinal Modeling Using Stata (first edition)


From   [email protected]
To   [email protected]
Subject   st: Exercise 7.10 in Multilevel and Longitudinal Modeling Using Stata (first edition)
Date   Tue, 9 Mar 2010 09:45:02 +0000

Hello all,

Looking further into my original query to Statalist (below), I have come 
across an exercise in the Stata book "Multilevel and Longitudinal Modeling 
Using Stata" by Rabe-Hesketh & Skrondal, which I think can help.  However, 
I am struggling with the exercise (exercise 7.10 Peak-expiratory-flow data 
I) and have been unable to find the solutions to see where I am going 
wrong.

Part 2 of the exercise asks you to verify that the two level model (with 
the variances of the two random coefficients constrained equal and if the 
covariance is positive) is equivalent to the three level model, but I have 
been unable to do this.  Please see the code and output below from the 
models I have used.  As you can see, the models do not appear to be 
equivalent.  However, I do not understand where I have made an error.

I would hugely appreciate any help with this, as this is proving to be a 
huge stumbling block for me.

Many thanks,

Gillian




*****************       Start Stata code
**      Section 7.2 multilevel modelling book
use http://www.stata-press.com/data/mlmus/pefr, clear
reshape long wp wm, i(id) j(occassion)

gen i = _n
reshape long w, i(i) j(meth) string
sort id meth occassion
list id meth occassion w in 1/8, clean noobs

encode meth, gen(method)
recode method 2=0

* section 7.4.4 - three level model
xtmixed w || id: || method:, mle

* exercise 7.10
* two level model
tab method, gen(m)
xtmixed w || id: m1 m2, mle cov(exch)

******************      Output

**      Three level model
Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log likelihood = -345.29139 
Iteration 1:   log likelihood = -345.29005 
Iteration 2:   log likelihood = -345.29005 

Computing standard errors:

Mixed-effects ML regression                     Number of obs      =  68

-----------------------------------------------------------
                |   No. of       Observations per Group
 Group Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
             id |       17          4        4.0          4
         method |       34          2        2.0          2
-----------------------------------------------------------

                                                Wald chi2(0)       =   .
Log likelihood = -345.29005                     Prob > chi2        =   .

------------------------------------------------------------------------------
           w |      Coef.   Std. Err.      z    P>|z|     [95% Conf. 
Interval]
-------------+----------------------------------------------------------------
       _cons |   450.8971   26.63839    16.93   0.000     398.6868 
503.1074
------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. 
Interval]
-----------------------------+------------------------------------------------
id: Identity                 |
                   sd(_cons) |   108.6037   19.05411      77.00246 
153.1739
-----------------------------+------------------------------------------------
method: Identity             |
                   sd(_cons) |   19.47623   4.829488      11.97937 
31.66474
-----------------------------+------------------------------------------------
                sd(Residual) |   17.75859   2.153545      14.00184 
22.52329
------------------------------------------------------------------------------
LR test vs. linear regression:       chi2(2) =   143.81   Prob > chi2 = 
0.0000

Note: LR test is conservative and provided only for reference.


** Two level model
note: m2 dropped because of collinearity

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log likelihood = -355.14961 
Iteration 1:   log likelihood = -355.14961 

Computing standard errors:

Mixed-effects ML regression                     Number of obs      =  68
Group variable: id                              Number of groups   =  17

                                                Obs per group: min =   4
                                                               avg = 4.0
                                                               max =   4


                                                Wald chi2(0)       =   .
Log likelihood = -355.14961                     Prob > chi2        =   .

------------------------------------------------------------------------------
           w |      Coef.   Std. Err.      z    P>|z|     [95% Conf. 
Interval]
-------------+----------------------------------------------------------------
       _cons |   454.0498   19.42288    23.38   0.000     415.9817 492.118
------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. 
Interval]
-----------------------------+------------------------------------------------
id: Exchangeable             |
                sd(m1 _cons) |   79.12354   9.858542      61.97959 
101.0096
              corr(m1,_cons) |   .0489807   .2547191     -.4230663 .500116
-----------------------------+------------------------------------------------
                sd(Residual) |   17.67097   2.122189      13.96483 
22.36069
------------------------------------------------------------------------------
LR test vs. linear regression:       chi2(2) =   124.10   Prob > chi2 = 
0.0000

Note: LR test is conservative and provided only for reference.




















----- Forwarded by Gillian Frost/STAFF/HSL on 09/03/2010 09:25 -----

[email protected] 
Sent by: [email protected]
08/03/2010 12:00
Please respond to
[email protected]


To
[email protected]
cc

Subject
st: -xtmixed- and differences in test-retest reliability






Hello all,

I was wondering if anyone would be able to help me with a problem I have. 
I know that there must be some way to do this, but I cannot for the life 
of me figure out how to do it.

A brief explanation of data:
Altogether there are about 40 subjects.  Each subject underwent a test to 
assess their hearing on three different days, three times each day.  The 
goal is to assess the reliability of the test (its reproducibility), as 
well as any between day or within day variation in test results.

I know that I can use xtmixed to estimate a variance-components model, the 

results of which can be used to estimate the test-retest reliability, the 
between days (within subject) intraclass correlation coefficient (ICC), 
and the within day ICC.  I would use the following model:
xtmixed result || subject: || day:

Now here is where I am getting confused.  What if I also wanted to know if 

the test-retest reliability differed depending on some other factor?  For 
example, what if (for some reason) the test was more reliable for males 
than females?  Or more reliable for older age groups than younger ones? 
How would I test for this?  I suppose I could use separate models for 
males and females, but how could I then test whether the ICCs were 
statistically significantly different?

Any help with this matter would be greatly appreciated.  Please just ask 
if anything needs clarifying.

Many thanks,

Gillian



------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential information intended
for the addressee(s) only. If this message was sent to you in error,
you must not disseminate, copy or take any action in reliance on it and
we request that you notify the sender immediately by return email.

Opinions expressed in this message and any attachments are not
necessarily those held by the Health and Safety Laboratory or any person
connected with the organisation, save those by whom the opinions were
expressed.

Please note that any messages sent or received by the Health and Safety
Laboratory email system may be monitored and stored in an information
retrieval system.
------------------------------------------------------------------------
Think before you print - do you really need to print this email?
------------------------------------------------------------------------

------------------------------------------------------------------------
Scanned by MailMarshal - Marshal's comprehensive email content security
solution. Download a free evaluation of MailMarshal at www.marshal.com
------------------------------------------------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential information intended
for the addressee(s) only. If this message was sent to you in error,
you must not disseminate, copy or take any action in reliance on it and
we request that you notify the sender immediately by return email.

Opinions expressed in this message and any attachments are not
necessarily those held by the Health and Safety Laboratory or any person
connected with the organisation, save those by whom the opinions were
expressed.

Please note that any messages sent or received by the Health and Safety
Laboratory email system may be monitored and stored in an information
retrieval system.
------------------------------------------------------------------------
Think before you print - do you really need to print this email?
------------------------------------------------------------------------

------------------------------------------------------------------------
Scanned by MailMarshal - Marshal's comprehensive email content security
solution. Download a free evaluation of MailMarshal at www.marshal.com
------------------------------------------------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index