Have you looked at Pinhiero and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer)? Bates and his graduate students, including Pinhiero, wrote "lme". This book has good examples that helped me solve problems like this.

hope this helps. spencer graves

Karl Knoblick wrote:

Hallo!

I have data of the following design: NSubj were measured at Baseline (visit 1) and at 3
following time points (visit 2, visit 3, visit 4).
There is or is not a treatment.


Most interesting is the question if there is a
difference in treatment between the results of visit 4
and baseline. (The other time points are also of
interest.) The level of significance is alpha=0.0179
(because of an interim analysis).

My questions:

1) I prefer calculating s model with the differences
to baseline as Y:
Y ~ treat*visit + Error(treat:id)
where treat is the treatment and id is the subject's
id
Other possibilities are:
a) Y0 ~ treat*visit + v1 + Error(treat:id)
where Y0 are the results (visit 2 to visit 4) and v1
is the result of visit 1 as covariate
b) Calculating a t-test with the results of visit 4
and visit 1
What's best?

2) When calculating a model (ANOVA) I have to
calculate the treatment effect (easy with coef(...)).
But how can I get the standard errors, or more exactly
the 98.21% confidence


intervals? - lm() does not work with an Error()-term in the
formula
- using lme(), I can not reproduce results e.g. of an
example of a text book ((Bortz,
Statistik f�r Sozialwissenschaftler, p.412, 3.
Auflage, see at the very end)


Here what I have done (with random data):

 # Random generation of data
 NSubj<-30 # No. of subjects
 set.seed(1234)
 id<-c(1:NSubj) # ID of subjects
 treat<-runif(NSubj, min=0, max=1) > 0.5 # Treatment
 v1<-runif(NSubj, min=0, max=1) # Result visit 1
Baseline)
 v2<-runif(NSubj, min=0, max=1) # Result visit 2
 v3<-runif(NSubj, min=0, max=1) # Result visit 3
 v4<-runif(NSubj, min=0, max=1) # Result visit 4

 # Making the data frame
 Y<-c(v2-v1,v3-v1,v4-v1) # Taking the differences to
baseline (visit 1)
 id<-as.factor(rep(id, 3))
 treat<-as.factor(rep(treat, 3))
 visit<-as.factor(rep(2:4, each=NSubj))
 df<-data.frame(id, treat, visit, Y)

 # Analysis
 df.aov <- aov(Y ~ treat*visit + Error(treat:id),
data=df)
 summary(df.aov)
 coef(df.aov)

How can I get the SE?

Hope somebody can help!

Karl

Example (Bortz, Statistik f�r Sozialwissenschaftler,
p.412, 3. Auflage), two-factorial


analysis of variance with repeated measurements:

Subject b1 b2 b3
al 1 56 52 48
al 2 57 54 46
al 3 55 51 51
al 4 58 51 50
al 5 54 53 46
a2 1 54 50 49
a2 2 53 49 48
a2 3 56 48 52
a2 4 52 52 50
a2 5 55 51 46
a3 1 57 49 50
a3 2 55 51 47
a3 3 56 48 51
a3 4 58 50 48
a3 5 58 46 52

The factors are A (a1,a2,a3) and B (b1,b2,b3); 5
subjects. Factor A is
kind of training (creativity) for the subjacts and
factor B is before,
during and after training.

The results of the example:

Source SS df sigma2 F
A 9.9 2 4.95 3.87
Subject in sample 15.4 12 1.28
between subjects 25.3 14
B 370.7 2 185.35 44.03 (**)
AxB 45.6 4 11.4 2.71
BxSubject 101.0 24 4.21
within subjects 517.3 30
Total 542.6 44

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help



______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to