I am new to gam, and most of my knowledge comes from this document http://www3.nd.edu/~mclark19/learn/GAMS.pdf. Now I am using generalized addictive model with random effects to model some data, where I want to see how "speedChange" correlates with "response" in my dataset, with consideration of random effects "user.id"
The code I run is shown as follows:
speed.gammer <- gamm4(response ~ s(speedChange) , data= t, random=~(1|user.id))
The gam can be plotted as follows:
I then try to interpret the gam:
summary(speed.gammer$gam)
which gives the following :
Family: gaussian
Link function: identity
Formula:
response ~ s(speedChange)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.30618 0.01482 155.6 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(speedChange) 5.875 5.875 28.61 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
R-sq.(adj) = 0.0263
lmer.REML = 14688 Scale est. = 0.57643 n = 5619
From what I understand from the output, I learned that speedChange is significantly correlates with response, and the non-linear relationship is as shown in the plot. I know the R-squared is small, but that's not what I want to ask. I actually don't understand the mer model.
If I run:
summary(speed.gammer$mer)
I got the following results:
Linear mixed model fit by REML ['lmerMod']
REML criterion at convergence: 14687.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.5908 -0.6500 -0.0454 0.5880 3.7110
Random effects:
Groups Name Variance Std.Dev.
user.id (Intercept) 0.2853 0.5342
Xr s(speedChange) 56.4011 7.5101
Residual 0.5764 0.7592
Number of obs: 5619, groups: user.id, 3042; Xr, 8
Fixed effects:
Estimate Std. Error t value
X(Intercept) 2.306181 0.014823 155.58
Xs(speedChange)Fx1 -0.008977 0.115045 -0.08
Correlation of Fixed Effects:
X(Int)
Xs(spdCh)F1 0.004
I understand this is an lmerMod. I understand the output for lmer function, but not here. I don't understand what "X" means in the fixed effects. From the t-value it seems that the Intercept is significant but not the speedChange. I want to report the result of my analysis, but what is the relationship between the gam results and this mer result? How can I interpret the mer result of
Xs(speedChange)Fx1 -0.008977 0.115045 -0.08
together with the gam result:
s(speedChange) 5.875 5.875 28.61 <2e-16 ***
I don't see any documents that help me to understand the output in order to report the result. Could someone help?