I'm new here, I've tried to run a lmer model:
lmer = lmer(RI ~ SET + LOG_VP + (1|API) + (1|ODOUR), data = a)
Could someone help me interpret the output?
Linear mixed model fit by REML ['lmerMod']
Formula: RI ~ SET + LOG_VP + (1 | API) + (1 | ODOUR)
Data: a
REML criterion at convergence: -349.9
Scaled residuals:
Min 1Q Median 3Q Max
-2.6167 -0.4719 -0.0357 0.5053 8.4850
Random effects:
Groups Name Variance Std.Dev.
API (Intercept) 0.01431 0.11964
ODOUR (Intercept) 0.00415 0.06442
Residual 0.00778 0.08820
Number of obs: 238, groups: API, 34; ODOUR, 14
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.15716 0.08792 1.787
SET 0.08180 0.05490 1.490
LOG_VP 0.03527 0.01968 1.792
Correlation of Fixed Effects:
(Intr) SET
SET -0.950
LOG_VP 0.083 -0.049
Thank you!
It depends on what your research question is, but
the response when both fixed effects are zero is is 0.15716
a 1 unit change in SET is associated with a 0.08180 change in RI
a 1 unit change in LOG_VP is associated with a 0.03527 change in RI
Variance at the API level is 0.01431
Variance at the ODOUR level is 0.00415
Residual (unit level) variance is 0.00778
Related
I am new to mixed models and have some problems. I've got a model:
lmer(F2 ~ (phoneme|individual) + (1|word) + age + frequency + (1|zduration), data = nurse_female)
Linear mixed model fit by REML ['lmerMod']
Formula:
F2 ~ (phoneme | individual) + (1 | word) + age + frequency +
(1 | zduration)
Data: nurse_female
REML criterion at convergence: 654.4
Scaled residuals:
Min 1Q Median 3Q Max
-2.09203 -0.20332 0.03263 0.25273 1.37056
Random effects:
Groups Name Variance Std.Dev. Corr
zduration (Intercept) 0.27779 0.5271
word (Intercept) 0.04488 0.2118
individual (Intercept) 0.34181 0.5846
phonemeIr 0.54227 0.7364 -0.82
phonemeVr 1.52090 1.2332 -0.93 0.91
Residual 0.06326 0.2515
Number of obs: 334, groups:
zduration, 280; word, 116; individual, 23
Fixed effects:
Estimate Std. Error t value
(Intercept) 1.79167 0.32138 5.575
age -0.01596 0.00508 -3.142
frequencylow -0.37587 0.18560 -2.025
frequencymid -1.18901 0.27738 -4.286
frequencyvery high -0.68365 0.26564 -2.574
Correlation of Fixed Effects:
(Intr) age frqncyl frqncym
age -0.811
frequencylw -0.531 -0.013
frequencymd -0.333 -0.006 0.589
frqncyvryhg -0.356 0.000 0.627 0.389
The model predicts the normalised formant values of vowels such in NURSE for female speakers. Without getting too much into it, there are roughly 3 variants possible that I coded under phoneme as <Er, Ir, Vr>. Individual describes the speaker. I managed to plot the F2 variance of each speaker using random effects.
But how do I plot the model predictions for the F2 values for each speaker with phoneme on the x-axis (i.e. 3 marks for <Er, Ir, Vr>) and F2 on the y-axis?
I tried a few ways but none of them worked.
Thanks in advance. If you need further information/data just say so
I am working on linguistic data and try to investigate the realisation of the vowel in words such as NURSE. There are more less 3 categories that can be realised, which I coded as <Er, Ir, Vr>. I then measured Formant values (F1 and F2). Then I created an LME that predicts the F1 and F2 values with different fixed and random effects but the main effect is a cross random effect of phoneme (i.e. <Er, Ir, Vr>) and individual. An example model can be found below.
Linear mixed model fit by REML ['lmerMod']
Formula:
F2 ~ (phoneme | individual) + (1 | word) + age + frequency +
(1 | zduration)
Data: nurse_female
REML criterion at convergence: 654.4
Scaled residuals:
Min 1Q Median 3Q Max
-2.09203 -0.20332 0.03263 0.25273 1.37056
Random effects:
Groups Name Variance Std.Dev. Corr
zduration (Intercept) 0.27779 0.5271
word (Intercept) 0.04488 0.2118
individual (Intercept) 0.34181 0.5846
phonemeIr 0.54227 0.7364 -0.82
phonemeVr 1.52090 1.2332 -0.93 0.91
Residual 0.06326 0.2515
Number of obs: 334, groups:
zduration, 280; word, 116; individual, 23
Fixed effects:
Estimate Std. Error t value
(Intercept) 1.79167 0.32138 5.575
age -0.01596 0.00508 -3.142
frequencylow -0.37587 0.18560 -2.025
frequencymid -1.18901 0.27738 -4.286
frequencyvery high -0.68365 0.26564 -2.574
Correlation of Fixed Effects:
(Intr) age frqncyl frqncym
age -0.811
frequencylw -0.531 -0.013
frequencymd -0.333 -0.006 0.589
frqncyvryhg -0.356 0.000 0.627 0.389
The question is now, how would I go about plotting the mean F2 values for each individual and for each of 3 variants <Er, Ir, Vr>?
I tried plotting the random effects as a caterpillar plot and get the following, but I am not sure, if this is accurate or does what I want. If what I have done Is right, are there any other better ways of plotting it?
ranefs_nurse_female_F2 <- ranef(nurse_female_F2.lmer8_2)
dotplot(ranefs_nurse_female_F2)
I estimate the interrater reliability using ICC from a random-intercept mixed-effects linear regression model. But how to get the confidence interval around the ICC.
elmer <- lmer(A_total ~ (1|Subject), data = data)
summary(elmer)
Linear mixed model fit by REML ['lmerMod']
Formula: A_total ~ 1 + (1 | Subject)
Data: data_A
REML criterion at convergence: 184.7
Scaled residuals:
Min 1Q Median 3Q Max
-1.41507 -0.29387 0.02918 0.45656 1.27346
Random effects:
Groups Name Variance Std.Dev.
Subject (Intercept) 3663.0 60.52
Residual 116.3 10.79
Number of obs: 20, groups: Kodnamn, 10
Fixed effects:
Estimate Std. Error t value
(Intercept) 337.35 19.29 17.49
I calculate ICC to be 3663.0 / (3663.0 + 116.3). But, how can I get the confidence interval around this ICC?
I am running a mixed effects logistic regression using lme4 in R.
I have one predictor that is a dichotomous categorical variable. It is coded 1/0 and is defined as a factor.
I find that the random item intercept is perfectly correlated with the random item slope for my predictor. So, I run a new model in which they are uncorrelated using the following code:
m1<-glmer(DV~1+PPTGender+(1|Subject)+(1+PPTGender||Item), data = data, family = "binomial")
However, the output gives me two terms for the random slope:
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: DV ~ 1 + PPTGender + (1 | Subject) + (1 + PPTGender || Item)
Data: data
AIC BIC logLik deviance df.resid
499.7 526.9 -242.9 485.7 353
Scaled residuals:
Min 1Q Median 3Q Max
-1.7334 -1.0057 0.6312 0.8807 1.3858
Random effects:
Groups Name Variance Std.Dev. Corr
Subject (Intercept) 6.323e-10 2.514e-05
Item (Intercept) 2.785e-09 5.278e-05
Item.1 PPTGender0 5.229e-01 7.231e-01
PPTGender1 6.889e-03 8.300e-02 -1.00
Number of obs: 360, groups: Subject, 60; Item, 36
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.28229 0.17833 1.583 0.113
PPTGender -0.07718 0.29534 -0.261 0.794
Correlation of Fixed Effects:
(Intr)
PPTGndr -0.635
Can anyone explain why this happens?
If I redefine the PPTGender variable as a numeric character variable like so:
data$PPTGender<-as.numeric(as.character(data$PPTGender))
It goes away:
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: DV ~ 1 + PPTGender + (1 | Subject) + (1 + PPTGender || Item)
Data: data
AIC BIC logLik deviance df.resid
500.8 520.2 -245.4 490.8 355
Scaled residuals:
Min 1Q Median 3Q Max
-1.4075 -1.0489 0.7410 0.8472 1.1603
Random effects:
Groups Name Variance Std.Dev.
Subject (Intercept) 3.638e-10 1.907e-05
PairNumber (Intercept) 2.081e-01 4.562e-01
PairNumber.1 PPTGender 1.091e-08 1.044e-04
Number of obs: 360, groups: Subject, 60; Item, 36
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.26056 0.14625 1.782 0.0748 .
PPTGender -0.03009 0.26720 -0.113 0.9103
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr)
PPTGendr -0.397
Is this just a quirk in R? Is there anything wrong with this latter approach?
I'm an R noob, I hope you can help me:
I'm trying to analyse a dataset in R, but I'm not sure how to interpret the output of summary(glmer(...)) and the documentation isn't a big help:
> data_chosen_stim<-glmer(open_chosen_stim~closed_chosen_stim+day+(1|ID),family=binomial,data=chosenMovement)
> summary(data_chosen_stim)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: open_chosen_stim ~ closed_chosen_stim + day + (1 | ID)
Data: chosenMovement
AIC BIC logLik deviance df.resid
96.7 105.5 -44.4 88.7 62
Scaled residuals:
Min 1Q Median 3Q Max
-1.4062 -1.0749 0.7111 0.8787 1.0223
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0 0
Number of obs: 66, groups: ID, 35
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.4511 0.8715 0.518 0.605
closed_chosen_stim2 0.4783 0.5047 0.948 0.343
day -0.2476 0.5060 -0.489 0.625
Correlation of Fixed Effects:
(Intr) cls__2
clsd_chsn_2 -0.347
day -0.916 0.077
I understand the GLM behind it, but I can't see the weights of the independent variables and their error bounds.
update: weights.merMod already has a type argument ...
I think what you're looking for weights(object,type="working").
I believe these are the diagonal elements of W in your notation?
Here's a trivial example that matches up the results of glm and glmer (since the random effect is bogus and gets an estimated variance of zero, the fixed effects, weights, etc etc converges to the same value).
Note that the weights() accessor returns the prior weights by default (these are all equal to 1 for the example below).
Example (from ?glm):
d.AD <- data.frame(treatment=gl(3,3),
outcome=gl(3,1,9),
counts=c(18,17,15,20,10,20,25,13,12))
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson(),
data=d.AD)
library(lme4)
d.AD$f <- 1 ## dummy grouping variable
glmer.D93 <- glmer(counts ~ outcome + treatment + (1|f),
family = poisson(),
data=d.AD,
control=glmerControl(check.nlev.gtr.1="ignore"))
Fixed effects and weights are the same:
all.equal(fixef(glmer.D93),coef(glm.D93)) ## TRUE
all.equal(unname(weights(glm.D93,type="working")),
weights(glmer.D93,type="working"),
tol=1e-7) ## TRUE