Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [lme4-nlme]

Questions connected to R packages lme4 and nlme for linear, generalized linear and nonlinear mixed effects models. For general questions about mixed models use [mixed-model] tag.

0
votes
1answer
16 views

Setting the intercept of a Binomial GLMM (glmer) to a set value

I have a run an experiment where subjects are given a choice between four objects. Their response is either correct or incorrect, however because there are four choices and only one is correct, it is ...
0
votes
0answers
18 views

Estimation of Random effects in lmer(): Defining model correctly

We have analyzed the levels of a protein in 500 samples, analyzing 100 samples in 5 consecutive experiments. 10 of the samples were included in all five experiments, which means there are 460 samples ...
0
votes
1answer
18 views

R - How to get estimates and p-values for random effects in glmer

I have data about around 100,000 protests nested within 40 countries and I want to analyze when the claims of a protest are directed at the state, based on action and country level characteristics, ...
0
votes
0answers
12 views

different results of predict() function and effect() (from effects package)

I've applied a linear mixed model to my data: ...
2
votes
1answer
29 views

Mixed effects model failing to converge - better to remove the random intercept? slope?

I have data for classes that are nested within schools There are two classes for most schools (n = 240), but I also have some schools with which I have more than two classes. i.e., 20 schools with ...
1
vote
1answer
46 views

LME residual plot returns a huge linear block of residual points

The publicly available data I used https://content.sph.harvard.edu/fitzmaur/ala2e/cd4.txt I addressed the unbalanced followup visits by transforming the visit time to the nearest multiple of 8 then ...
2
votes
1answer
48 views

Explaining tourist numbers over time to historic sites, based on a set of predictors

I've been struggling for some time trying to figure out the most appropriate way to analyse some data. My task is to (hopefully) explain what may be driving the flow of visitors/tourists to two ...
0
votes
1answer
14 views

Post-hoc comparison using lsmeans paired vs unpaired

I am doing a linear mixed model in R (lmer) to investigate the difference in activity levels (AL) between two disease groups and two kinds of therapy. Additionally, it is repeated measures data, each ...
0
votes
0answers
8 views

Plotting mixed-effects logistic regression [on hold]

I'm trying to make a plot similar to those one below. However, the predict function does not seem to work with the output of an S4 object, which is produced by glmer with a binomial family. If ...
2
votes
1answer
25 views

Doing a multilevel model using lmer with participants nested in time - should time be a factor or not?

I am using function lmer() within package "lme4". Repeated-measures design with 4 time points, data is in long format. The time points are equidistant apart. Should I treat that variable as an integer,...
0
votes
0answers
44 views

How to Interpret the result of generalized linear mixed model?

I ran a generalized linear mixed model using lmer in R, and I'm struggling how to interpret the result. The response variable is a result of 25 consecutive binary choices. The point where I'm stuck is:...
0
votes
0answers
15 views

Difference in t-values between baseline and subset, linear mixed model R

I have a dataset with a dependent variable (DV) measured in 4 conditions and 15 subjects. I am running a LME model with factor "CONDITION" with 4 levels (A, B, C and D). I also have another factor, ...
1
vote
2answers
61 views

GEE vs LME, non-normal distribution

I have a question about statistics theory. I have longitudinal, repeated measures data where the response variable is skewed right. Using R, I ran a linear mixed-effects model (good for longitudinal, ...
0
votes
0answers
73 views

How to run lme without using the EM algorithm? [closed]

I'm trying to fit a linear mixed model by lme using specific starting values, and without resorting to the EM algorithm to refine them prior to optimization. I'm ...
2
votes
2answers
56 views

glmer fitting different models if binary variable is integer 0,1 or factor

This seems like a relatively basic question, but I can't find good pointers after two days of searching. I am trying to fit a generalized linear mixed model to data obtained in an experiment. The ...
1
vote
1answer
37 views

glmer model in r, negative slope for a predictor, data seems to have positive slope

I fitted a glmer model to my data in r (with package lme4), one of significant fixed effects (order, which is continuous) has a negative estimate. But when I graph the averaged data, it seems to have ...
2
votes
1answer
29 views

Why does gls model without random effects yield a similar fit to mixed effects model?

I am trying to answer a question from Pinhiero and Bates Mixed Effects Models in S and S-Plus, explaining how random effects fail to confer any benefit over a gls model that has mixed effects. This ...
2
votes
0answers
15 views

Answers to exercises in Pinhiero and Bates' book

Can anyone tell me where to find the answers to the Exercises in Pinhiero and Bates' book Mixed Effects Models in S and S-Plus? I want to check my answers against someone who knows better.
1
vote
2answers
39 views

Preparing data for linear mixed effects model [closed]

I want to fit my linear mixed effects model to test the impact of an ecological restoration project. I have a single (impact) site and (multiple) control sites and multiple before/after years data set....
0
votes
0answers
12 views

How to account for different numbers of trials for percentage data in R?

I'm trying to figure out a correct way to set up a linear mixed model (or similar) for a decision-making experiment. Design was as follows: 2 x 2 within-subjects DV: count/percentage More ...
0
votes
0answers
20 views

glm model with two nested variables in R (lme4)

I have a problem writing a glmm model in the lme4 package. A little background: I measured olfactory behavior (OB) in fruit flies (80 genetic lines in total), they are from two different populations, ...
1
vote
0answers
22 views

Difference between random slopes and a random intercept for each combination of a random:fixed effect?

In a mixed effects model, I'm trying to understand the distinction between the following two models: y ~ group + (1+group|subject) and ...
0
votes
1answer
30 views

Paired t-test following main effect of mixed model with missing data

I am analyzing data for a repeated measures study with missing data. For example here is a 3 X 3 experimental design with three conditions and 3-time measures: I am using a mixed model for the main ...
0
votes
0answers
25 views

inflated and inconsistent degrees of freedom using Satterthwaite's approximation with lme4 and lmerTest

In an unbalanced ecological dataset of 32 plots with 2 observations each, we conducted lmer-models on 3 different dependent variables representing abundances (individuals1 and individuals2) and ...
0
votes
0answers
14 views

Adding random slopes for all predictors and interactions with lme4

I'm running some mixed-effect logistic regressions using lme4. So far, all the models contained two random effects (subject and item), and now I would like as well random slopes for all predictors and ...
1
vote
1answer
34 views

Is it possible (does it make sense) to force lme starting from a user-supplied residual variance?

I wish to run lme with a pre-specified starting value for the residual variance. I know that this may not be the best thing to do, but I have to start from that ...
3
votes
2answers
928 views

Dealing with singular fit in mixed models

Let's say we have a model ...
0
votes
0answers
25 views

How would I plot a random effect model with categorical predictors in R?

I've run a random intercept model in the lmer package in R where I have a response (count data) as a function of a binary categorical variable with a random intercept of time, for repeated measures. I ...
1
vote
1answer
19 views

why pdLogChol initialised at a model fit does not match the pdLogChol of the fitted model?

I'm trying to build and initialize a pdLogChol object from a fitted lme model. However, although the ...
0
votes
0answers
19 views

Overall Factor Estimate in a Linear Mixed Model

I have a fixed Factor with 8 levels (Condition), alongside two fixed effects (two predictor variables) in a linear mixed-model. I would like to compare the total effect of condition on the dependent ...
1
vote
1answer
76 views

Regression coefficient has negative symbol but positive from the raw plot

EDIT the data is here https://www.dropbox.com/s/ufrqesp1tmeh3ll/my.data.csv?dl=0 My data consists of a crop yield value collected over multiple locations and year. This is what my data looks like: ...
0
votes
0answers
21 views

Messy lmer() output?

I must say that I've been working with R and linear mixed effects models only for about 3 months learning on my own mistakes but I would appreciate some input. I have 5 groups (between subject design)...
0
votes
1answer
42 views

Testing the significance of a main effect using model comparison, when an interaction is included

I am fitting a linear mixed effect model (using lmer), and want to obtain p-values via model comparison. As far as I understand it, the procedure is: (i) create a ...
1
vote
1answer
36 views

Insights into generalized mixed model

I am trying to assess the effect of a treatment. $Y$ is the response variable with two levels - 0 and 1. The predictor variable (denoted with column name $grp$ in the data given below) also has two ...
0
votes
1answer
22 views

Model validity and specific contrasts in mixed model

I have a design where mice are distributed in a two-way anova setup. With genotype (WT and KO) and treatment (Ctrl and Treat). From each mouse 5 different tissues have been extracted and the number of ...
0
votes
1answer
38 views

Reporting glmer.nb Results

I'm running a mixed negative binomial GLM that looks like this: Niche2 <- glmer.nb(log_density ~ height * factor(Year) + (1 | Grouping), data = NicheData2) ...
2
votes
1answer
33 views

How can I reproduce the gllamm() Stata function in R?

I'm currently working in a project, where I replicate a project that has been conducted with Stata. I, however, work with R. The task is to estimate a multi level logit model. In Stata, the project ...
1
vote
0answers
21 views

Compairing quasi-Poisson and negative binomial fits in R

Are there any R functions that allow you to easily compare quasi-Poisson and negative binomial models to determine which error distribution is more appropriate for your data? Or - does this require ...
1
vote
0answers
27 views

Why can't you fit a quasi-Poisson in `lme4`? [closed]

Is there a philosophical reason why lme4 does not allow you to fit a quasi-Poisson model while it will allow you to fit a negative binomial model? I do not see any reason why any glmm package should ...
1
vote
0answers
25 views

Compare multiple Slopes between conditions

I am working with data extracted from Electroencephalography (EEG) studies done to 10 subjects and related behavioural data. In the next plot I show the relation between behavioural data (x axis) and ...
0
votes
0answers
9 views

why the parameters resulted from nlme or nls are scaled??

I am doing research on applying nlme to loss reserving compartmental model but I do not understand why the parameters from the model are scaled when using nlme or nls to obtain. Below is the link to ...
1
vote
1answer
62 views

Build confidence intervals for random effects in intercept only models

I'm building a Poisson model for a rate between an outcome and an offset (to be precise between the observed and predicted values of a phenomenon). I want to get this rate + confidence intervals (CI) ...
3
votes
1answer
64 views

RM ANOVA: time as continuous or categorical?

I am using the lme() funtion in R (from nlme package) to perform a Repeated Measures ANOVA. Here's the formula ...
2
votes
1answer
44 views

interpreting correlations from lmer object

I'm having problems understanding how to interpret correlations in mixed models ...
3
votes
1answer
111 views

What would be a Bayesian equivalent of this mixed-effects logistic regression model

I have been using "glmer" in R to model a binary outcome for approximately 500 persons, in two groups, each measured at three points in time. My questions of interest are a) whether the change over ...
1
vote
1answer
40 views

Appropriate way to model nested random effect structure with lme4

Let's say I have data on firms (nested within countries). Some firms are multinational, others only have a single instance. The dependent variable is revenue. What is the appropriate way to account ...
0
votes
0answers
24 views

Crossed and multi-nested factors in GLM/Cox mixed models

In the fig. below there is a graphic summary of the experiment that I’m designing. I will have two factors (i) time that lobster egg clutches are exposed to the air (air-exposure), three levels of ...
1
vote
2answers
57 views

does comparing models make sense?

Let's say I have 3 factors f1, f2 and f3 and fit these models ...
1
vote
1answer
45 views

Have I correctly specified my lmer model for crossed/nested experiment?

I have to setup an experiment for which generating data is very expensive. But we also want to assess the effects of several parameters. The experiment looks like this: Summary : On the first day, a ...