0
$\begingroup$

I have a question in mixed models. I'm quite new at this field and I'm trying to calculate a model in which "y" is predicted according to multiple covariates (Age,gender,BMI) and the random variable "randX". randX has two different unique values and I have 150 repeats with each of the values. I want the var-cov matrix to be a diagonal matrix with the same variance for both of randX types (but zero variance between the types). I read a lot about this subject and this is what I did so far. I have no idea if this is the right model.

model <- lme(y ~ Age+gender+BMI, data = df, random=list(randX = pdIdent(~Age+gender+BMI)), method = "REML")

please help me with that. Thanks.

$\endgroup$
1
  • $\begingroup$ If randX has only two possible values, it cannot be a random effect. $\endgroup$ – amoeba Aug 22 '18 at 11:17
1
$\begingroup$

Considering randX as a random effect means that the observed values of randX are viewed as one possible sample from a broader population of values. And these values are assumed to follow a $\text{N}(0, \sigma^2_{\text{randX}})$ distribution. In R, the syntax 1 | randX is used to specify a random effect on the intercept at the randX level.

$\endgroup$
3
  • $\begingroup$ Thank you for your answer. I know that this is the way to do it for a General symmetric positive-definite var-cov (default). I use this code in this case: model <- lme(y ~ Age+gender+BMI, data = df, random=~1|randX, method = "REML"). However, I want to apply a Multiple of an identity var-cov matrix and I don't know how. $\endgroup$ – Amit Aug 22 '18 at 10:49
  • $\begingroup$ In this case, you do not have a covariance matrix, only a variance... $\endgroup$ – ocram Aug 22 '18 at 11:02
  • $\begingroup$ That is true. So how do I implement it using lme? $\endgroup$ – Amit Aug 22 '18 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.