[R] difference of means as response?

Douglas G. Scofield dgscofie at indiana.edu
Tue Apr 18 01:08:39 CEST 2006


Dear R users,

I am looking for some advice on the proper construction of a mixed model
in R, using the difference in means as the response and treating
within-means residuals as a random effect.

I have a dataframe (my own, a snippet of which is given below) that is
composed of observations of pollen viability in flowers along tree
branches.  Flowers (1 to 3 per position) were collected from apical and
basal positions along the same branch, and I'm predicting that the
within-branch difference between the mean viabilities at each position
is a function of the distance separating the positions, with tree as a
random effect.  A collection of observations for a single branch is:

   tree        branch position dist viability
10 T113 B.T113.May.16   apical 6.46 0.9733333
11 T113 B.T113.May.16   apical 6.46 1.0000000
12 T113 B.T113.May.16   apical 6.46 0.9766667
13 T113 B.T113.May.16    basal 6.46 0.9933333
14 T113 B.T113.May.16    basal 6.46 0.9929078

Up til now, I've been calculating within-position means for each branch
and constructing a separate dataframe with one observation per branch,
so for the above the new dataframe would contain a single entry

   tree        branch  mean.basal  mean.apical   dist
   T113 B.T113.May.16   0.9931206    0.9833333   6.46

and then I'm doing

   lme(mean.apical - mean.basal ~ dist, random=~1|tree)

I get sensible results in line with my predictions, but it occurs to me
that I might be losing information here, and that this might be better
expressed by calculating the within-position means within the model and
treating the within-position-among-flower residuals as a random effect,
either common to the entire model or grouped in various ways.  However,
I can't come up with a way to express this in lme.  To be honest, I am
also unsure as to whether this makes any statistical sense to attempt.

I'd appreciate any advice, thank you.

Regards,

Douglas G. Scofield, PhD        Department of Biology 
dgscofie at indiana.edu            Indiana University
off: (812) 856-0115             1001 E. 3rd St.
fax: (812) 855-6705             Bloomington, IN  47405-3700
cell 1: (812) 219-5373          cell 2: (786) 514-9141

-------------------------------------------------

A piece of my dataframe is below:

> ex
   tree        branch position dist viability
1  T112 A.T112.May.16   apical 1.26 0.9900000
2  T112 A.T112.May.16   apical 1.26 0.9860140
3  T112 A.T112.May.16   apical 1.26 1.0000000
4  T112 A.T112.May.16    basal 1.26 0.9900000
5  T112 C.T112.May.16   apical 1.94 0.9800000
6  T112 C.T112.May.16    basal 1.94 1.0000000
7  T113 A.T113.May.16   apical 3.36 1.0000000
8  T113 A.T113.May.16   apical 3.36 0.9942197
9  T113 A.T113.May.16    basal 3.36 1.0000000
10 T113 B.T113.May.16   apical 6.46 0.9733333
11 T113 B.T113.May.16   apical 6.46 1.0000000
12 T113 B.T113.May.16   apical 6.46 0.9766667
13 T113 B.T113.May.16    basal 6.46 0.9933333
14 T113 B.T113.May.16    basal 6.46 0.9929078
15 T113 C.T113.May.16   apical 5.00 1.0000000
16 T113 C.T113.May.16   apical 5.00 0.9966667
17 T113 C.T113.May.16    basal 5.00 0.9933333
18 T113 C.T113.May.16    basal 5.00 0.9929078
19 T113 D.T113.May.16   apical 5.84 0.9933333
20 T113 D.T113.May.16   apical 5.84 0.9966667
21 T113 D.T113.May.16    basal 5.84 0.9933333
22 T113 D.T113.May.16    basal 5.84 0.9929078
23 T113 E.T113.May.16   apical 4.50 1.0000000
24 T113 E.T113.May.16   apical 4.50 0.9818182
25 T113 E.T113.May.16   apical 4.50 0.9966667
26 T113 E.T113.May.16    basal 4.50 1.0000000
27 T113 E.T113.May.16    basal 4.50 0.9955752
28 T113 E.T113.May.16    basal 4.50 0.9900000
29 T113 F.T113.May.16   apical 5.01 0.9933333
30 T113 F.T113.May.16   apical 5.01 1.0000000
31 T113 F.T113.May.16    basal 5.01 1.0000000
32 T113 F.T113.May.16    basal 5.01 0.9955752
33 T113 F.T113.May.16    basal 5.01 0.9900000
34 T115 A.T115.Jun.02   apical 4.24 0.9333333
35 T115 A.T115.Jun.02   apical 4.24 0.9933333
36 T115 A.T115.Jun.02    basal 4.24 0.9900000
37 T115 A.T115.Jun.02    basal 4.24 0.9766667
38 T115 B.T115.Jun.02   apical 2.31 0.9866667
39 T115 B.T115.Jun.02   apical 2.31 0.9801325
40 T115 B.T115.Jun.02    basal 2.31 0.9900000
41 T115 B.T115.Jun.02    basal 2.31 0.8267974




More information about the R-help mailing list