Skip to content

Zero cells in contrast matrix problem

3 messages · Ben Bolker, Francesco Romano

#
at this point, if I were you I would set

options(error=recover)

and debug at the point at which the program stops: this will be at
this point in the code:

if (length(cov) == p) {
      cov <- diag(cov, p)
    } else if (length(cov) != p^2) {
      stop("normal prior covariance of improper length")
    }

so you should be able to print(p) to find out the appropriate size.


On Mon, Oct 26, 2015 at 7:37 AM, Francesco Romano
<francescobryanromano at gmail.com> wrote:
#
Hello again,

if I understand you correctly, you're trying to get R to tell you
what the p value should be. This is the result of using
the commands you indicated:
{stop("normal prior covariance of improper length")}
Error: object 'p' not found
No suitable frames for recover()

I'm not sure what I did wrong. I have both the bglmer and MCMCglmm packages
loaded.
On Mon, Oct 26, 2015 at 1:57 PM, Ben Bolker <bbolker at gmail.com> wrote:

            

  
    
#
---------- Forwarded message ----------
From: Francesco Romano <francescobryanromano at gmail.com>
Date: Tue, Oct 27, 2015 at 5:04 AM
Subject: Re: Zero cells in contrast matrix problem
To: Ben Bolker <bbolker at gmail.com>
Cc: "r-sig-mixed-models at r-project.org" <r-sig-mixed-models at r-project.org>


Hello again,

if I understand you correctly, you're trying to get R to tell you
what the p value should be. This is the result of using
the commands you indicated:
Error: object 'p' not found
No suitable frames for recover()

I'm not sure what I did wrong. I have both the bglmer and MCMCglmm
packages loaded.


   I wasn't sufficiently clear.
   I wasn't suggesting that you run that particular code: I was
suggesting that you should set options as specified, and then try to
run your model.  When you hit an error, it will drop you into a
browser (it will give you a choice of which "frame" to select, at
which you point you can print the value of the p variable.  I just
tried this, and my session looked like this:
## run model with a bogus covariance matrix size
family=binomial,
                       fixef.prior = normal(cov = diag(9,17)))

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

Enter a frame number, or 0 to exit

1: bglmer(predation ~ ttt + (1 | block), data = newdat, family = binomial, fix
2: do.call(mkBglmerDevfun, c(glmod, glmod$X, glmod$reTrms, list(priors = list(
3: (function (fr, X, reTrms, family, nAGQ = 1, verbose = 0, maxit = 100, contr
4: evaluatePriorArguments(priors$covPriors, priors$fixefPrior, NULL, c(n = nro
5: evaluateFixefPrior(fixefPrior, defnEnv, evalEnv)
6: eval(fixefPrior, envir = evalEnv)
7: eval(expr, envir, enclos)
8: normal(cov = diag(9, 17))
9: normal(cov = cov, common.scale = FALSE)

## I chose i:

Selection: 8
Called from: top level
Browse[1]> ls()
[1] "cov"         "matchedCall" "normal"      "sd"
Browse[1]> print(p)
[1] 4

  This tells me that I should have specified a 4-by-4 covariance matrix.
On Mon, Oct 26, 2015 at 1:57 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