result_table: Result table for linear models, (bayesian) multilevel models...

Usage Arguments

View source: R/result_table.r

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
result_table(
  object,
  var_predict = NULL,
  new_labels = NULL,
  sem_labels = NULL,
  sem_regressions = FALSE,
  sem_labelled = FALSE,
  std = TRUE,
  rope = FALSE,
  print = FALSE,
  digits = 2,
  ...
)

Arguments

object

An object of class lm, lmerModLmerTest or lavaan.

var_predict

A character value or character vector indicating which paths should be included in the output. Each path can be printed individually by passing the predictor variable to this argument.

new_labels

A character vector with new labels for the paths in the model (needs to have the same number of values as paths in the model, potentially including the intercept).

sem_labels

When using lavaan for SEM, paths can be labelled in the model. With this argument, one can specify which of the labelled paths should be printed (takes a single character value or a character vector). This argument only works with objects of class lavaan.

sem_regressions

A logical value specifying whether only regressions should be included. This argument only works with objects of class lavaan.

sem_labelled

A logical value specifying whether only paths with labels should be included. This argument only works with objects of class lavaan.

std

A logical value indicating whether standarized coefficient should be included (works only with objects of class lm and lavaan).

print

A logical value indicating whether the resulting table should be formatted according to APA-guidelines.

digits

How many digits should be printed? Defaults to 2.

...

Additional arguments that can be passed to describe_posterior from the package bayestestR (e.g., ci = .90 to adjust the probability of the credible intervals, by default 89

This function creates a printable results table based objects of class lm, lmerModLmerTest, brmsfit or lavaan. Several arguments can be specified in order to customize the output. ## Example 1: Linear model mod.lm <- lm(mpg ~ cyl, mtcars) result_table(mod.lm, new_labels = c("", "H1"), print = TRUE)

## Example 2: Multilevel model mod.lmer <- lmerTest::lmer(Reaction ~ 1 + Days + (1 | Subject), sleepstudy) result_table(mod.lmer) result_table(mod.lmer, new_labels = c(1, 2))

## Example 3: Structural equation model model.sem <- ' # latent variables ind60 =~ x1 + x2 + x3 dem60 =~ y1 + y2 + y3 + y4 dem65 =~ y5 + y6 + y7 + y8

# regressions dem60 ~ a*ind60 dem65 ~ b*ind60 + c*dem60

# residual covariances y1 ~~ y5 y2 ~~ y4 + y6 y3 ~~ y7 y4 ~~ y8 y6 ~~ y8 ' fit.sem <- sem(model.sem, data = PoliticalDemocracy) result_table(fit.sem, sem_regressions = TRUE) result_table(fit.sem, sem_labelled = TRUE) result_table(fit.sem, sem_labelled = TRUE, new_labels = c("H1", "H2", "H3"), std = FALSE, print = TRUE)

# Example 4: Bayesian multilevel modelling library(multilevel) set.seed(15324) d <- sim.icc(gsize = 10, ngrp = 100, icc1 = .30, nitems = 2, item.cor = .50) fit <- brm(VAR2 ~ VAR1 + (1|GRP), data = d, chains = 1) result_table(fit, print = TRUE) result_table(fit, new_labels = c("", "H1"), rope = T, print = T, digits = 3, ci = .95)


masurp/pmstats documentation built on Oct. 6, 2020, 9:24 p.m.