1
$\begingroup$

I'm currently running a time series analysis which requires me to fit lmer models to each of my data points. Here is my code :

# import data
dt <- h5read('file.h5', 'd1/table')
dt$cond <- as.factor(dt$cond)
dt$sub <- as.factor(dt$sub)

# close file
H5close()

# apply model to each time point
fitted <- by(dt, dt$tp, function(x) lmer(size ~ cond + (1 + cond | sub), data = x))

In this model, cond is a 2 levels fixed effect factor and sub is a 14 levels random effect factor. For some reason, the model doesn't yield a t-value in its ouput :

> fitted[1]
$`0`
Linear mixed model fit by REML ['lmerMod']
Formula: size ~ cond + (1 + cond | sub)
   Data: x
REML criterion at convergence: -7694.797
Random effects:
 Groups   Name        Std.Dev.  Corr 
 sub      (Intercept) 1.388e-02      
          cond1       1.169e-05 -1.00
 Residual             7.922e-02      
Number of obs: 3467, groups:  sub, 14
Fixed Effects:
(Intercept)        cond1  
   0.023743    -0.001154

Is it the output I should have expected? It seems that R doesn't take the difference between both levels of cond into account.

$\endgroup$

closed as off-topic by Andy, Tim, Christoph Hanck, kjetil b halvorsen, Greenparker May 18 '16 at 11:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Andy, Christoph Hanck, Greenparker
If this question can be reworded to fit the rules in the help center, please edit the question.

2
$\begingroup$

You can obtain t statistics for the fixed effects estimates by using the summary() function. For example:

require(lme4) 
fm1 <- lmer ( Reaction ~ Days + ( Days | Subject ), sleepstudy )
summary(fm1)

Linear mixed model fit by REML ['lmerMod']
Formula: Reaction ~ Days + (Days | Subject)
   Data: sleepstudy

REML criterion at convergence: 1743.6

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.9536 -0.4634  0.0231  0.4634  5.1793 

Random effects:
 Groups   Name        Variance Std.Dev. Corr
 Subject  (Intercept) 612.09   24.740       
          Days         35.07    5.922   0.07
 Residual             654.94   25.592       
Number of obs: 180, groups:  Subject, 18

Fixed effects:
            Estimate Std. Error t value
(Intercept)  251.405      6.825   36.84
Days          10.467      1.546    6.77

Correlation of Fixed Effects:
     (Intr)
Days -0.138
$\endgroup$
  • $\begingroup$ The output above is already a summary. But for some reason, I have no t-value in mine. $\endgroup$ – Crolle May 18 '16 at 11:36
  • 1
    $\begingroup$ @Crolle, no your code just outputs the model object itself. summary() is different. Use summary(fitted[1]) instead $\endgroup$ – Robert Long May 18 '16 at 12:04
  • $\begingroup$ actually you were almost there : summary(fitted[[1]]) works just fine. Not used to these brackets yet! $\endgroup$ – Crolle May 18 '16 at 12:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.