# [S] varcomp and the jackknife

Max_Kuhn@ms.bd.com
Wed, 19 Aug 1998 09:59:02 -0400

From: Max Kuhn@BDX on 08/19/98 09:59 AM

Hello all,
I'm finding some odd behavior when I attempt to use the jackknife to get
an idea of the variability in estimated variance components. My data are
in a data frame called balanced.df. It is a balanced dataset of a factorial
design in three variables (replicated three times). Some information about
the data frame:
> balanced.df<-data.frame(x1,x2,x3,y)
> is.random(balanced.df)<-T
>
> is.random(balanced.df)
x1 x2 x3
T T T
>
> table(x1,x2,x3)
, , 52
1 3 5
10 3 3 3
13 3 3 3
21 3 3 3
, , 64
1 3 5
10 3 3 3
13 3 3 3
21 3 3 3
, , 68
1 3 5
10 3 3 3
13 3 3 3
21 3 3 3
As expected, I can fit the full two factor random effects model with
varcomp
using:
> balanced.fit <- varcomp(y ~ (x1 + x2 + x3)^2, balanced.df,
method =c("winsor", "r"))
> summary(balanced.fit)
Call:
varcomp(formula = y ~ (x1 + x2 + x3)^2, data = balanced.df, method =
c("winsor", "r"))
Variance Estimates:
Variance
x1 2.346257e-004
x2 4.008911e-004
x3 2.346016e-005
x1:x2 5.612958e-004
x1:x3 1.892888e-006
x2:x3 3.271779e-007
Residuals 8.651387e-006
Method: winsor reml
:
:
However, instead of formal testing, I would like to have (rough) confidence
intervals for this model. The bootstrap does not appear to be an option
since
with three replications, the random sampling may have missing cells (out of
27). A first attempt at the jackknife:
> # jackknife(balanced.df,eval(balanced.fit)\$variances)
fails. After defining the function
> F.bal.fit<-function(data){
+ is.random(data)<-T
+ tt<-varcomp(y ~ (x1 + x2 + x3)^2, data, method =
c("winsor","r"))\$variances
+ # cat(tt,"\n")
+ tt
+ }
I try
> balanced.jack<-jackknife(balanced.df,F.bal.fit)
Error in fit.fun(y = y, x = temp\$xmat, z = temp\$zmat, method..: apparently
only 1
degree of freedom for a random effect
Dumped
However, by uncommenting the cat statement, I find that 13 jackknifed
estimates are computed without this error. My question is: Since I have
three replications (81 observations) and the jackknife is only removing
one at a time, why does this error occur?
Max

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news