# [R-sig-ME] Leading minor of order 4 in downdated X'X is not positive definite

Gregor GORJANC gregor.gorjanc at bfro.uni-lj.si
Tue Jan 1 06:27:29 CET 2008

```Hi!

First of all happy new year and all the best in 2008!

Does anyone have any idea how to trick lmer() in the same way as
lm() to constrain one regression slope to zero in nested regression.
The following code shows what I want to do:

## Generate data

x1 <- runif(n=100, min=-4, max=1)
y1 <- rep(606, length(x1)) + rnorm(n=100, sd=10)
x1 <- x1 + 1995

x2 <- runif(n=100, min=0, max=8)
y2 <- (606 + 0.14) - 51.8 * x2 + rnorm(n=100, sd=10)
x2 <- x2 + 1997

y <- c(y1, y2)
x <- c(x1, x2)
f <- factor(rep(c("A", "B"), each=100))
g <- factor(rep(letters[1:20], times=10))

## Plot

plot(y ~ x, type="p", xlim=c(1991, 2005), ylim=c(0, 700))

## Fit model - (nested) regression for each "period"

lm(y ~ f * x)
## OK

lmer(y ~ f * x + (1 | g))
## OK

## Fit model - (nested) regression for each "period", but constrain
## slope to zero in first "period"

x2 <- x
x2[1:100] <- 0

lm(y ~ f * x2)
## OK

lmer(y ~ f * x2 + (1 | g))
Error in lmer(y ~ f * x2 + (1 | g)) :
Leading minor of order 4 in downdated X'X is not positive definite

Thanks!

--
Lep pozdrav / With regards,
Gregor Gorjanc

----------------------------------------------------------------------------------------------------
University of Ljubljana          PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                            mail: gregor.gorjanc <at> bfro.uni-lj.si
SI-1230 Domzale                tel: +386 (0)1 72 17 861
Slovenia, Europe                 fax: +386 (0)1 72 17 888
----------------------------------------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
you have no certainty until you try." Sophocles ~ 450 B.C.
----------------------------------------------------------------------------------------------------

--
Lep pozdrav / With regards,
Gregor Gorjanc

----------------------------------------------------------------------------------------------------
University of Ljubljana          PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                            mail: gregor.gorjanc <at> bfro.uni-lj.si
SI-1230 Domzale                tel: +386 (0)1 72 17 861
Slovenia, Europe                 fax: +386 (0)1 72 17 888
----------------------------------------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
you have no certainty until you try." Sophocles ~ 450 B.C.

```