Dear R-helpers,

I'd like to understand how to test the statistical significance of a 
random effect in gamm. I am using gamm because I want to test a model 
with an AR(1) error structure, and it is my understanding neither gam 
nor gamm4 will do the latter.

The data set includes nine short interrupted time series (single case 
designs in education, sometimes called N-of-1 trials in medicine) from 
one study. They report a proportion as outcome (y), computed from a 
behavior either observed or not out of 10 trials per time point. Hence I 
use binomial (I believe quasi-binomial is not available in gamm). Each 
of the nine series has an average of 30 observations give or take (total 
264 observations), some under treatment (z) and some not. xc is centered 
session number, int is the z*xc interaction. Based on prior work, xc is 
also smoothed

Consider, for example, two models, both with AR(1) but one allowing a 
random effect on xc:

g1 <- gamm(y ~ s(xc) +z+ int,family=binomial, weights=trial, 
correlation=corAR1())
g2 <- gamm(y ~ s(xc) +z+ int,family=binomial, weights=trial, random = 
list(xc=~1),correlation=corAR1())

I include the output for g1 and g2 below, but the question is how to 
test the significance of the random effect on xc. I considered a test 
comparing the Log-Likelihoods, but have no idea what the degrees of 
freedom would be given that s(xc) is smoothed. I also tried:

anova(g1$gam, g2$gam)

that did not seem to return anything useful for this question.

A related question is how to test the significance of adding a second 
random effect to a model that already has a random effect, such as:

g3 <- gamm(y ~ xc +z+ s(int),family=binomial, weights=trial, random = 
list(Case=~1, z=~1),correlation=corAR1())
g4 <- gamm(y ~ xc +z+ s(int),family=binomial, weights=trial, random = 
list(Case=~1, z=~1, int=~1),correlation=corAR1())

Any help would be appreciated.

Thanks.

Will Shadish
********************************************
g1
$lme
Linear mixed-effects model fit by maximum likelihood
   Data: data
   Log-likelihood: -437.696
   Fixed: fixed
X(Intercept)           Xz         Xint    Xs(xc)Fx1
    0.6738466   -2.5688317    0.0137415   -0.1801294

Random effects:
  Formula: ~Xr - 1 | g
  Structure: pdIdnot
                  Xr1          Xr2          Xr3 Xr4          
Xr5          Xr6          Xr7          Xr8 Residual
StdDev: 0.0004377781 0.0004377781 0.0004377781 0.0004377781 0.0004377781 
0.0004377781 0.0004377781 0.0004377781 1.693177

Correlation Structure: AR(1)
  Formula: ~1 | g
  Parameter estimate(s):
       Phi
0.3110725
Variance function:
  Structure: fixed weights
  Formula: ~invwt
Number of Observations: 264
Number of Groups: 1

$gam

Family: binomial
Link function: logit

Formula:
y ~ s(xc) + z + int

Estimated degrees of freedom:
1  total = 4

attr(,"class")
[1] "gamm" "list"
****************************
 > g2
$lme
Linear mixed-effects model fit by maximum likelihood
   Data: data
   Log-likelihood: -443.9495
   Fixed: fixed
X(Intercept)           Xz         Xint    Xs(xc)Fx1
  0.720018143 -2.562155820  0.003457463 -0.045821030

Random effects:
  Formula: ~Xr - 1 | g
  Structure: pdIdnot
                  Xr1          Xr2          Xr3 Xr4          
Xr5          Xr6          Xr7          Xr8
StdDev: 7.056078e-06 7.056078e-06 7.056078e-06 7.056078e-06 7.056078e-06 
7.056078e-06 7.056078e-06 7.056078e-06

  Formula: ~1 | xc %in% g
          (Intercept) Residual
StdDev: 6.277279e-05 1.683007

Correlation Structure: AR(1)
  Formula: ~1 | g/xc
  Parameter estimate(s):
       Phi
0.1809409
Variance function:
  Structure: fixed weights
  Formula: ~invwt
Number of Observations: 264
Number of Groups:
         g xc %in% g
         1        34

$gam

Family: binomial
Link function: logit

Formula:
y ~ s(xc) + z + int

Estimated degrees of freedom:
1  total = 4

attr(,"class")
[1] "gamm" "list"


-- 
William R. Shadish
Distinguished Professor
Founding Faculty

Mailing Address:
William R. Shadish
University of California
School of Social Sciences, Humanities and Arts
5200 North Lake Rd
Merced CA  95343

Physical/Delivery Address:
University of California Merced
ATTN: William Shadish
School of Social Sciences, Humanities and Arts
Facilities Services Building A
5200 North Lake Rd.
Merced, CA 95343

209-228-4372 voice
209-228-4007 fax (communal fax: be sure to include cover sheet)
wshad...@ucmerced.edu
http://faculty.ucmerced.edu/wshadish/index.htm
http://psychology.ucmerced.edu



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to