lme4

Mixed model starting values for lme4

对着背影说爱祢 提交于 2019-12-13 15:30:56
问题 I am trying to fit a mixed model using the lmer function from the lme4 package. However, I do not understand what should be input to the start parameter. My purpose is to use a simple linear regression to use the coefficients estimated there as starting values to the mixed model. Lets say that my model is the following: linear_model = lm(y ~ x1 + x2 + x3, data = data) coef = summary(linear_model)$coefficients[- 1, 1] #I remove the intercept result = lmer(y ~ x1 + x2 + x3 | x1 + x2 + x3, data

post hoc - comparison of point on slope to another group

别等时光非礼了梦想. 提交于 2019-12-13 03:47:05
问题 I have a model that combines a dummy and a continuous variable to describe an outcome following a disturbance. So if there was a disturbance, I have time measurements at times 1:16 following the disturbance. If there was no disturbance in the recent past, the outcome is coded to a fake time value of -1. Here's a representation of the dataset: library(lme4) library(ggplot2) df <- data.frame(ID = rep(c("a", "b", "c"), each = 20), Time = c(1:16, -1, -1, -1, -1, 1:16, -1, -1, -1, -1, 1:16, -1, -1

predict and model.matrix give different predicted means within levels of a factor variable

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 01:46:57
问题 This question arose as a result of another question posted here: non-conformable arguments error from lmer when trying to extract information from the model matrix When trying to obtain predicted means from an lmer model containing a factor variable, the output varies depending on how the factor variable is specified. I have a variable agegroup, which can be specified using the groups "Children <15 years", "Adults 15-49 years", "Elderly 50+ years" or "0-15y", "15-49y", "50+y". My choice

LMERConvenienceFunctions error on back and forward fitting functions: model not a mer object

点点圈 提交于 2019-12-12 15:44:55
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 6 years ago . I tried using bfFixefLMER_t.fnc or fitLMER.fnc from the LMERConvenienceFunctions package. In both the cases, I get an error that "the input model is not a mer object". I tried out the examples from http://artax.karlin.mff.cuni.cz/r-help/library/LMERConvenienceFunctions/html/00Index.html. I get the same errors. For example when I run from the example fitLMER.fnc(mB, backfit.on =

R: analyzing multiple responses (i.e. dependent variables) in a mixed effects model (lme4)

巧了我就是萌 提交于 2019-12-12 08:58:02
问题 I have a, what I thought, really simple question. In a longitudinal experiment with a group of participants has everyone rated everyone else on, let's say, 10 variables (e.g. "This person is likeable.", "This person is dull." and so on) at 7 different times. If i want to get some sort of perceiver and target variance for one variable/response I'd use: lmer(scale(Var1) ~ (1|target) + (1|perceiver), data= subset(x, time_point == 1)) Here we have a dependent variable "Var1" of a dataframe "x"

lme4::lmer reports “fixed-effect model matrix is rank deficient”, do I need a fix and how to?

旧城冷巷雨未停 提交于 2019-12-12 04:48:56
问题 I am trying to run a mixed-effects model that predicts F2_difference with the rest of the columns as predictors, but I get an error message that says fixed-effect model matrix is rank deficient so dropping 7 columns / coefficients. From this link, Fixed-effects model is rank deficient, I think I should use findLinearCombos in the R package caret . However, when I try findLinearCombos(data.df) , it gives me the error message Error in qr.default(object) : NA/NaN/Inf in foreign function call

Interference between lme4 and nlme packages

怎甘沉沦 提交于 2019-12-12 03:22:53
问题 I had this script: mod<-lmList(log(indwgt)~log(lngtclass)| sex, data=mbsp) that worked two weeks ago. Today I get Error in eval(expr, envir, enclos) : object 'indwgt' not found I feel it is due to interferences between lme4 and nlme, but I don't know how to remove nlme. If it is of any help, I tried this: getAnywhere(lmList) 2 differing objects matching ‘lmList’ were found in the following places package:lme4 namespace:lme4 namespace:nlme but it is meaningless to me, apart from strengthening

lmer Error: number of observations < number of random effects

允我心安 提交于 2019-12-11 17:05:35
问题 I am trying to run an LMM allowing time to be a random effect: lmer(efficacy ~ time + (1+time|id), data=long, REML=TRUE) However, I get the error messageas below: Error: number of observations (=3948) <= number of random effects (=4496) for term (1 + time | id); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable I have three time points but not all subjects have data for all 3 time points (attrition) but my missing count on my outcome

How to plot multiple glmer models into one single plot?

▼魔方 西西 提交于 2019-12-11 14:23:25
问题 I have two glmer models with two covariates each that I'm trying to plot into a single figure. MWE : ## generalized linear mixed model library(lattice) cbpp$response <- sample(c(0,1), replace=TRUE, size=nrow(cbpp)) gm1 <- glmer(response ~ size + incidence + (1 | herd), data = cbpp, family = binomial) cbpp$obs <- 1:nrow(cbpp) gm2 <- glmer(response ~ size + incidence + (1 | herd) + (1|obs), family = binomial, data = cbpp) I am trying to plot the predicted values againts each covariate for each

non-conformable arguments error from lmer when trying to extract information from the model matrix

梦想与她 提交于 2019-12-11 12:03:43
问题 I have some longitudinal data from which I'd like to get the predicted means at specified times. The model includes 2 terms, their interaction and a spline term for the time variable. When I try to obtain the predicted means, I get "Error in mm %*% fixef(m4) : non-conformable arguments" I've used the sleep data set from lmer to illustrate my problem. First, I import the data and create a variable "age" for my interaction sleep <- as.data.frame(sleepstudy) #get the sleep data # create fake