[R-sig-ME] Two random effects with identical conditional modes
boomslang
boomslang_fibs at yahoo.co.uk
Tue Jul 23 23:57:48 CEST 2013
Hi Jarrod,
Thanks for your reply and the link you provided. I tried to get lme4a to work on several installations of R (2.13, 2.15, 3.0) to follow Douglas Bates' tips. Unfortunately I keep getting the error message:
Loading required package: minqa
Loading required package: Rcpp
Loading required package: MatrixModels
Error in inDL(x, as.logical(local), as.logical(now), ...) :
function 'cholmod_l_start' not provided by package 'Matrix'
In addition: Warning messages:
1: package 'minqa' was built under R version 2.13.2
2: package 'Rcpp' was built under R version 2.13.2
3: package 'MatrixModels' was built under R version 2.13.2
Error: package/namespace load failed for 'lme4a'
I use Windows XP (32bits) and 7 (64 bits)...
Kind regards
----- Original Message -----
From: Jarrod Hadfield <j.hadfield at ed.ac.uk>
To: boomslang <boomslang_fibs at yahoo.co.uk>
Cc: "r-sig-mixed-models at r-project.org" <r-sig-mixed-models at r-project.org>
Sent: Monday, 22 July 2013, 18:40
Subject: Re: [R-sig-ME] Two random effects with identical conditional modes
Hi,
This is called a multimembership model, and there is information on
how to fit them in this thread:
http://comments.gmane.org/gmane.comp.lang.r.lme4.devel/6264
There are now better ways to specify this type of model in MCMCglmm,
but the lmer suggestions by Doug may still be up to date.
Cheers,
Jarrod
Quoting boomslang <boomslang_fibs at yahoo.co.uk> on Mon, 22 Jul 2013
00:33:17 +0100 (BST):
>
>
> Hello all,
>
> I have data with one categorial variable 'p'. A binary outcome
> ('result') is the result of a process determined by exactly two
> DIFFERENT levels of p.
>
> I am interested in the contribution of each level of p to the
> outcome of 'result'.
>
> The code below produces a small but similar version of the dataset:
>
> set.seed( 1)
> p <- letters[1:6]
>
> p1 <- sample( p, 30, replace = T)
> p2 <- sample( p, 30, replace = T)
> result <- runif( n = 30) > 0.7
>
> x <- data.frame( p1, p2, result)
> x <- subset( x, p1 != p2)
> print( x, row.names = F)
>
>
> If I do
>
> glmer( result ~ 1 + (1|p1) + (1|p2), x, binomial)
> ranef( fm)
>
> ... I get different conditional modes for the levels in p1 and p2,
> but this is not what I want since the condional mode of 'a' in p1
> should be the same as the conditional mode of 'a' in p2.
>
> If I look at the random effects model matrix fm at Zt I see:
>
>
> 12 x 27 sparse Matrix of class "dgCMatrix"
>
> [1,] . . . . . . . . . 1 . . . . . . . . . . . 1 . . 1 . . #p1-a
> [2,] 1 . . . 1 . . . . . 1 1 . . . . . . . 1 . . 1 . . . . #p1-b
> [3,] . 1 . . . . . . . . . . 1 . 1 . . 1 . . . . . 1 . 1 .
> [4,] . . 1 . . . . 1 1 . . . . . . . . . . . 1 . . . . . .
> [5,] . . . . . . . . . . . . . 1 . 1 . . . . . . . . . . .
> [6,] . . . 1 . 1 1 . . . . . . . . . 1 . 1 . . . . . . . 1 #p1-f
> [7,] . . . . . . . 1 . . . . . . . 1 . . . . . . 1 1 . . . #p2-a
> [8,] . . . 1 . . . . . . . . . . . . . . . . . 1 . . 1 . . #p2-b
> [9,] 1 . 1 . . . . . . 1 . . . . . . 1 . 1 . 1 . . . . . .
> [10,] . 1 . . . . . . . . . 1 1 1 . . . . . . . . . . . 1 1
> [11,] . . . . 1 1 1 . 1 . 1 . . . 1 . . 1 . . . . . . . . .
> [12,] . . . . . . . . . . . . . . . . . . . 1 . . . . . . . #p2-f
>
>
> ... while I need Zt to be more like this:
>
> [1,] . . . . . . . 1 . 1 . . . . . 1 . . . . . 1 1 1 1 . . # a
> [2,] 1 . . 1 1 . . . . . 1 1 . . . . . . . 1 . 1 1 . 1 . . # b
> [3,] 1 1 1 . . . . . . 1 . . 1 . 1 . 1 1 1 . 1 . . 1 . 1 . # c
> [4,] . 1 1 . . . . 1 1 . . 1 1 1 . . . . . . 1 . . . . 1 1 # d
> [5,] . . . . 1 1 1 . 1 . 1 . . 1 1 1 . 1 . . . . . . . . . # e
> [6,] . . . 1 . 1 1 . . . . . . . . . 1 . 1 1 . . . . . . 1 # f
>
>
> i.e. a 6x27 with exactly two 1's in each column.
>
> Is there a simple way/trick to obtain this? Is the Pinheiro package
> perhaps better suited for my problem?
>
>
> Any help is appreciated. Thanks in advance.
>
>
> PS: The dataset is very large: it has about 2 million rows and 'p'
> has about 10000 levels. (This is the reason why I use random effects
> for p. Preferably I would use fixed
> effects.)
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the R-sig-mixed-models
mailing list