mixed-models

I can't get lsmeans output in glmer

江枫思渺然 提交于 2019-12-13 07:15:41
问题 List. I have a generalized mixed model using lmer.test package and calling glmer. I can get a good model, however I can't get the output of the LSMEANS and Diff means. Here's what I have library(plyr) library(lubridate) library(chron) library(reshape) library(lattice) library(car) library(lmerTest) fm17<-glmer(I(Steps+1)~Treatment + treatdate +Weight + BF+ (1|Block) +(0+treatdate|exp.unit), family=poisson) summary(fm17,ddf="Kenward-Roger") qqnorm(resid(fm17),main="QQ Model 17") plot(fm17,main

Probability predictions with cumulative link mixed models

倖福魔咒の 提交于 2019-12-13 02:21:41
问题 I am trying to fit cumulative link mixed models with the ordinal package but there is something I do not understand about obtaining the prediction probabilities. I use the following example from the ordinal package: library(ordinal) data(soup) ## More manageable data set: dat <- subset(soup, as.numeric(as.character(RESP)) <= 24) dat$RESP <- dat$RESP[drop=TRUE] m1 <- clmm2(SURENESS ~ PROD, random = RESP, data = dat, link="logistic", Hess = TRUE,doFit=T) summary(m1) str(dat) Now I am trying to

post hoc test for a two way mixed model anova

自古美人都是妖i 提交于 2019-12-12 12:50:13
问题 I am doing a repeated measures anova with a mixed model. I would like to run a post hoc test to see the p-values of the interaction TREAT*TIME, but I only managed to use the following ghlt Tukey test which do not give me the interaction I am looking for. library(multcomp) library(nlme) oi<-lme(total ~ TREAT * TIME, data=TURN, random = ~1|NO_UNIT) anova(oi) summary(glht(oi, linfct=mcp(TIME="Tukey", TREAT="Tukey"))) what I would be looking for is something like: summary(glht(oi, linfct=mcp(TIME

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"

Cubic spline method for longitudinal series data?

早过忘川 提交于 2019-12-12 08:02:15
问题 I have a serial data formatted as follows: time milk Animal_ID 30 25.6 1 31 27.2 1 32 24.4 1 33 17.4 1 34 33.6 1 35 25.4 1 33 29.4 2 34 25.4 2 35 24.7 2 36 27.4 2 37 22.4 2 80 24.6 3 81 24.5 3 82 23.5 3 83 25.5 3 84 24.4 3 85 23.4 3 . . . Generally, 300 animals have records of milk in different time points of short period. However, if we join their data together and do not care about different animal_ID, we would have a curve between milk~time like this, the line in figure below: Also, in the

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

R: Alleged “missing values” when no values are actually missing for MCMCglmm

寵の児 提交于 2019-12-12 03:06:48
问题 I have a data structured as follows: A is the count of positive cases in a cohort B is the total count of the cohort minus A . C is a binary variable D - F are normally distributed continuous variables G is 6 level factor I am using MCMCglmm package in R to analyse this data to find which of the variables C - G affect A and B . I have done this successfully using lme4's glmer function with success but now I wish to add more random effects which I have been advised will be better handled by

Extract Fixed Effect and Random Effect in Dataframe

和自甴很熟 提交于 2019-12-11 10:50:38
问题 I'm using lme4 package to run mixed model. I want to extract fixed effect result and random effect result in seperate dataset, so that we can use it for further analysis. But unfortunately I could not. E.g. mixed_result<- lmer(Reaction ~ Days + (1|Subject), data = sleepstudy) I tried to extract fixed effect and random effect using the following method: fixEffect<-fixef(mixed_result) randEffect<-ranef(mixed_result) View(fixEffect) I tried fixef and ranef for fixed effect and random effect

Phylogenetic model using multiple entries for each species

痞子三分冷 提交于 2019-12-11 07:27:41
问题 I am relatively new to phylogenetic regression models. In the past I used PGLS when I had only 1 entry for each species in my tree. Now I have a dataset with thousands of records for a total of 9 species and I would like to run a phylogenetic model. I read the tutorial of the most common packages (e.g. caper) but I am unsure how to build the model. When I try to create the object for caper, i.e. using: obj <- comparative.data(phy = Tree, data = Data, names.col = species, vcv = TRUE, na.omit =

How can I carry out model simplification for a MCMCglmm?

不羁的心 提交于 2019-12-11 05:47:22
问题 I have a mixed-effects model that I am running in the package MCMCglmm in R. There are several possible predictors that I am interested in exploring. How can I carry out model simplification to exclude uninformative predictors from the model? In other contexts, I have used stepwise backwards regression i.e. starting with a "full" model which contains all of the predictors that I am interested in, and using drop1() to find uninformative variables, followed by update() to remove them from the