# [R] negative variances

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Wed Apr 11 14:57:21 CEST 2007

```In fact this implies that random-effects might not be the way to go
for your data. When you're using random-effects the marginal
covariance matrix is of the form:

V = Z D Z^t + Sigma,

where Z is the design matrix for the random-effects, D their
covariance matrix and Sigma is the covariance matrix for the error
terms. If the correlation between the repeated measurements of your
sample units could be explain by a set of random-effects, then D
should be a positive definite matrix. However, note that V might be
positive definite even if D it is not, as in your case, which implies
that the assumption of some common random-effects that the sample
units share might not be valid.

Alternatively, you could model directly the marginal covariance matrix
V using the 'correlation' and 'weights' arguments of gls().

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm

----- Original Message -----
From: "Tu Yu-Kang" <yukangtu at hotmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Wednesday, April 11, 2007 12:34 PM
Subject: [R] negative variances

> Dear R experts,
>
> I had a question which may not be directly relevant to R but I will
> be
> grateful if you can give me some advices.
>
> I ran a two-level multilevel model for data with repeated
> measurements over
> time, i.e. level-1 the repeated measures and level-2 subjects. I
> could not
> get convergence using lme(), so I tried MLwiN, which eventually
> showed the
> level-2 variances (random effects for the intercept and slope) were
> negative values. I know this is known as Heywood cases in the
> structural
> equation modeling literature, but the only discussion on this
> problem in
> the literature of multilevel models and random effects models I can
> find is
> in the book by Prescott and Brown.
>
> Any suggestion on how to solve this problem will be highly
> appreciated.
>
> Many thanks.
>
> With best regards,
>
> Yu-Kang
>
>

--------------------------------------------------------------------------------

> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help