Skip to content

Zero cells in contrast matrix problem

8 messages · Ben Bolker, Francesco Romano, Thompson,Paul

#
I wonder if anyone can help with the separation problem originally solved
by Ben Bolker (see thread).
The model and fitting I used previously was

trial<-bglmer(Correct ~ Syntax.Semantics, data = trialglm, family =
binomial, fixef.prior = normal(cov = diag(9,4))

which now has to change because the Syntax.Semantcs factor needs to be
split into separate
within-subjects variables, Syntax, a factor with two levels, and Animacy, a
factor with four levels.
In addition a new between-subjects factor called Group with two levels
(native vs non-native speaker)
has to be added which determines the following model, fit by bglmer:

trial<-bglmer(Correct ~ Syntax*Animacy*Group+ (1|Part.name)+(1|Item), data
= trialglm, family = binomial,
fixef.prior = normal(cov = diag???)

What values should I use for the cov=diag portion in order to continue
attempting convergence of a model
that includes the random effects?

R returns the following error because I don't know how to establish the
parameters when more than one
fixed effect is involved:

Error in normal(cov = cov, common.scale = FALSE) :
  normal prior covariance of improper length

Many thanks in advance for any help!
On Thu, May 28, 2015 at 10:46 PM, Ben Bolker <bbolker at gmail.com> wrote:

            

  
    
#
On 15-10-26 06:56 AM, Francesco Romano wrote:
In general a reasonable form is normal(cov = diag(v,np)) where v is
the prior variance (generally something reasonably
large/non-informative; 9 (=std dev of 3) is probably an OK default) and
np is the number of fixed-effect parameters.  You can figure this out via

ncol(model.matrix(~Syntax*Animacy*Group,data=trialglm)

or multiply 2*4*2 to get 16 ...
#
Many thanks Ben,

but I tried that already:
bglmer(Correct~Syntax*Animacy*Prof.group.2+(1|Part.name)+(1|Item), data =
revana, family = binomial, fixef.prior = normal(cov = diag(9,16)))
fixed-effect model matrix is rank deficient so dropping 2 columns /
coefficients
Error in normal(cov = cov, common.scale = FALSE) :
  normal prior covariance of improper length
On Mon, Oct 26, 2015 at 12:06 PM, Ben Bolker <bbolker at gmail.com> wrote:

            

  
    
#
Well, that's a separate problem (and not necessarily a "problem").   R
is telling you that you have 16 separate combinations of the factors,
but only 14 unique combinations represented in your data set, so it
can only estimate 14 parameters.  Unless there is a weird interaction
with blme I don't know about, this should still give you reasonable
answers.

On Mon, Oct 26, 2015 at 7:10 AM, Francesco Romano
<francescobryanromano at gmail.com> wrote:
#
For some reason the silly bugger didn't past the full command:
bglmer(Correct~Syntax*Animacy*Prof.group.2+(1|Part.name)+(1|Item), data =
revana, family = binomial, fixef.prior = normal(cov = diag(9,16)))
fixed-effect model matrix is rank deficient so dropping 2 columns /
coefficients
Error in normal(cov = cov, common.scale = FALSE) :
  normal prior covariance of improper length

To give more info on this, it is the Animacy factor that is causing
separation because two levels of it have zero counts in some cases.
On Mon, Oct 26, 2015 at 12:13 PM, Ben Bolker <bbolker at gmail.com> wrote:

            

  
    
#
Ah.  So try normal(cov=diag(9,14)) ...

On Mon, Oct 26, 2015 at 7:18 AM, Francesco Romano
<francescobryanromano at gmail.com> wrote:
1 day later
#
This is a problem in SAS as well. When you specify a contrast in a 2-factor design, things get screwed up with missing cells. In fact, the contrasts require a matrix multiplication, and if a cell isn't there, the matrix multiplication does not work correctly. They are not estimable, in the SAS terminology (which is standard statistical terminology as well).

One approach that can be used is to convert the 2-factor design to a one-factor design, and do everything with contrasts, main effects, in teractions, etc. A little more work, but since you are specifying the contrasts (and presuming that you do so correctly), you will get estimable contrasts.

Marginal effects must take the missing cells into account correctly.

-----Original Message-----
From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of Francesco Romano
Sent: Monday, October 26, 2015 6:18 AM
To: Ben Bolker; r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] Zero cells in contrast matrix problem

For some reason the silly bugger didn't past the full command:
bglmer(Correct~Syntax*Animacy*Prof.group.2+(1|Part.name)+(1|Item), data = revana, family = binomial, fixef.prior = normal(cov = diag(9,16))) fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients Error in normal(cov = cov, common.scale = FALSE) :
  normal prior covariance of improper length

To give more info on this, it is the Animacy factor that is causing separation because two levels of it have zero counts in some cases.
On Mon, Oct 26, 2015 at 12:13 PM, Ben Bolker <bbolker at gmail.com> wrote:

            
--
Frank Romano Ph.D.

Tel. +39 3911639149

*LinkedIn*
https://it.linkedin.com/pub/francesco-bryan-romano/33/1/162

*Academia.edu*
https://sheffield.academia.edu/FrancescoRomano


_______________________________________________
R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-----------------------------------------------------------------------
Confidentiality Notice: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
privileged and confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply e-mail and destroy
all copies of the original message.
#
I think this isn't as much of a problem as you think.  lme4
automatically drops non-estimable columns in the model matrix.  The
problem is just getting it to work right with blme.  (But yes,
collapsing this into a one-way design is one way of proceeding ...)

On Tue, Oct 27, 2015 at 12:01 PM, Thompson,Paul
<Paul.Thompson at sanfordhealth.org> wrote: