Skip to content

Conveting SAS Proc mixed to R code

3 messages · Ben Bolker, magali proffit

#
[cc'ing back to r-sig-mixed-models, with apologies]
On 04/15/2011 02:38 PM, Kevin Wright wrote:
Interesting.  I'm a bit confused myself.  I guess these are two
different models (I think):

 * if we use (1|Block/Variety), we are estimating a random intercept
across blocks and a random intercept across varieties within blocks;
all random effect values are independent of each other (e.g. eps_B(i) vs
eps_B(j) for i \neq j, eps_V(i) vs eps_V(j) for i \neq j, eps_B(i) vs
eps_V(j) for *all* i,j).  Parameters are sigma^2_B and sigma^2_V.

 * if we use (Variety|Block), we are estimating variance of the
intercept across blocks, estimates of the variance of two contrasts
('Marvellous' vs 'Golden Rain' and 'Victory' vs 'Golden Rain') across
blocks, as well as the correlations among the contrasts -- parameters
are sigma^2(GR,M vs GR,V vs GR), rho_{all 3 pairwise contrasts}.

  The first way is certainly the classic way to do it (it's also the way
it's presented in MASS).  It's also more parsimonious, although in
principle the information you get out from the new way could be
interesting (allows e.g. for non-sphericity -- different correlations
among levels within blocks).  I guess the second way reduces to the
first when there is a single value of sigma^2 and a single value of rho ...

 cheers
   Ben Bolker
#
magali proffit <mafgali at ...> writes:
You haven't given us very much to go on.  How many days
(relevant to whether you will be able to estimate a random effect
reliably)?  How many insects?

  You can estimate the size of the treatment efect with the
model suggested above.

  You can use anova() to compare models with and without
treatment effects to get likelihood ratio test statistics.
However, LRTs assume large data sets.  You may not have a large
data set.

  You can use parametric bootstrapping: see the examples
under help("simulate-mer").

  If your data are not too extreme (i.e. not too many zeros),
you can see if square-root transforming followed by classical
mixed model ANOVA gives you a reasonable answer.