rStats.js v1.3.0
    Preparing search index...

    Function lmerContest

    • Tests of contrasts L β = rhs of the fixed effects of a linear mixed model fitted by lmer, with Satterthwaite's degrees of freedom. Equivalent to lmerTest::contest() in R.

      L is one contrast (a vector, one value per fixed effect) or several (an array of rows). By default the rows are tested jointly: an F-test of the hypothesis, rotated to its eigenvectors (rows that are linearly dependent count once; a row set of rank 0 gives an empty table). With joint: false each row has its own t-test, with a confidence interval at level unless confint is false. The degrees of freedom come from the analytic derivatives at the exact optimum (see lmerSummary).

      Parameters

      • fit: LmerResult

        A result of lmer (the object it returned, not a copy).

      • L: readonly number[] | readonly (readonly number[])[]

        A contrast, or an array of contrasts (rows).

      • Optionaloptions: LmerContestOptions & { joint?: true }

        rhs, joint, confint, level.

      Returns LmerContestF

      // R: contest(lmerTest::lmer(y ~ x + (1 | g), data), c(0, 1), joint = FALSE)
      const fit = lmer("y ~ x + (1 | g)", {
      y: [3.1, 4.0, 5.2, 6.8, 7.1, 8.3, 2.2, 3.5, 3.9, 5.9, 6.1, 7.4],
      x: [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
      g: ["a", "a", "a", "b", "b", "b", "c", "c", "c", "d", "d", "d"],
      });
      const t = lmerContest(fit, [0, 1], { joint: false });
      t.estimate; // [0.85]
      t.lower; // [0.60388]
      // R: contest(fit, diag(2))
      const f = lmerContest(fit, [[1, 0], [0, 1]]);
      f.numDF; // [2]
      f.F; // [47.804]
    • Tests of contrasts L β = rhs of the fixed effects of a linear mixed model fitted by lmer, with Satterthwaite's degrees of freedom. Equivalent to lmerTest::contest() in R.

      L is one contrast (a vector, one value per fixed effect) or several (an array of rows). By default the rows are tested jointly: an F-test of the hypothesis, rotated to its eigenvectors (rows that are linearly dependent count once; a row set of rank 0 gives an empty table). With joint: false each row has its own t-test, with a confidence interval at level unless confint is false. The degrees of freedom come from the analytic derivatives at the exact optimum (see lmerSummary).

      Parameters

      • fit: LmerResult

        A result of lmer (the object it returned, not a copy).

      • L: readonly number[] | readonly (readonly number[])[]

        A contrast, or an array of contrasts (rows).

      • options: LmerContestOptions & { joint: false }

        rhs, joint, confint, level.

      Returns LmerContestT

      // R: contest(lmerTest::lmer(y ~ x + (1 | g), data), c(0, 1), joint = FALSE)
      const fit = lmer("y ~ x + (1 | g)", {
      y: [3.1, 4.0, 5.2, 6.8, 7.1, 8.3, 2.2, 3.5, 3.9, 5.9, 6.1, 7.4],
      x: [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
      g: ["a", "a", "a", "b", "b", "b", "c", "c", "c", "d", "d", "d"],
      });
      const t = lmerContest(fit, [0, 1], { joint: false });
      t.estimate; // [0.85]
      t.lower; // [0.60388]
      // R: contest(fit, diag(2))
      const f = lmerContest(fit, [[1, 0], [0, 1]]);
      f.numDF; // [2]
      f.F; // [47.804]
    • Tests of contrasts L β = rhs of the fixed effects of a linear mixed model fitted by lmer, with Satterthwaite's degrees of freedom. Equivalent to lmerTest::contest() in R.

      L is one contrast (a vector, one value per fixed effect) or several (an array of rows). By default the rows are tested jointly: an F-test of the hypothesis, rotated to its eigenvectors (rows that are linearly dependent count once; a row set of rank 0 gives an empty table). With joint: false each row has its own t-test, with a confidence interval at level unless confint is false. The degrees of freedom come from the analytic derivatives at the exact optimum (see lmerSummary).

      Parameters

      • fit: LmerResult

        A result of lmer (the object it returned, not a copy).

      • L: readonly number[] | readonly (readonly number[])[]

        A contrast, or an array of contrasts (rows).

      • Optionaloptions: LmerContestOptions

        rhs, joint, confint, level.

      Returns LmerContestF | LmerContestT

      // R: contest(lmerTest::lmer(y ~ x + (1 | g), data), c(0, 1), joint = FALSE)
      const fit = lmer("y ~ x + (1 | g)", {
      y: [3.1, 4.0, 5.2, 6.8, 7.1, 8.3, 2.2, 3.5, 3.9, 5.9, 6.1, 7.4],
      x: [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
      g: ["a", "a", "a", "b", "b", "b", "c", "c", "c", "d", "d", "d"],
      });
      const t = lmerContest(fit, [0, 1], { joint: false });
      t.estimate; // [0.85]
      t.lower; // [0.60388]
      // R: contest(fit, diag(2))
      const f = lmerContest(fit, [[1, 0], [0, 1]]);
      f.numDF; // [2]
      f.F; // [47.804]