1
$\begingroup$

In a previous question (Equivalent to Welch's t-test in GLS framework) it was asked whether nlme can reproduce Welch's t-test.

Below is an abridged version of this older question:

A standard independent samples t-test (where it is assumed that the samples being compared are drawn from populations with equal variance) can be expressed as follows:

$$Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i$$

where $Y$ is the outcome and $X$ is a binary variable corresponding to group membership. The significance test of $\beta_1$ will produce the same t statistic as the standard independent samples t-test. Thus, the two commands below produce the same statistics (with the same degrees of freedom):

t.test(extra~group, data = sleep, var.equal = TRUE)  
lm(extra~group, data = sleep)

The provided answer to this question indicated that using gls (in the nlme package) with specificed weights

weights=varIdent(form = ~ 1 | group)) 

would do the trick.

I am curious whether this can also be implemented in lme4 (using lmer). When going through the help file of lme4 I could not find anything that corresponds to the weight option in nlme::gls.

$\endgroup$
4

0