MyNixOS website logo
Description

Toolkit for Compiling, (Post-Hoc) Testing, and Plotting Regression Results.

Compiling regression results into a publishable format, conducting post-hoc hypothesis testing, and plotting moderating effects (the effect of X on Y becomes stronger/weaker as Z increases).

regrrr (Toolkit for Compiling and Plotting Regression Results)

Rdoc

Description

Compiling regression results into a publishable format, conducting post-hoc hypothesis testing, and plotting moderating effects (the effect of X on Y becomes stronger/weaker as Z increases).

Installation

To install from CRAN:

install.packages("regrrr")
library(regrrr)

You can also use devtools to install the latest development version:

devtools::install_github("RkzYang/regrrr")
library(regrrr)

Examples

# build regression models using mtcars dataset
data(mtcars)
m0 <- lm(mpg ~ vs + carb + hp + wt, data = mtcars)
m1 <- update(m0, . ~ . + wt * hp)
m2 <- update(m1, . ~ . + wt * vs)
# compile the correlation table
cor.table(data = m2$model)
# compile the regression table
regression_table <- rbind(
combine_long_tab(to_long_tab(summary(m0)$coef),
                 to_long_tab(summary(m1)$coef),
                 to_long_tab(summary(m2)$coef)),
compare_models(m0, m1, m2))
rownames(regression_table) <- NULL
print(regression_table)
# plot the moderating effect
plot_effect(reg.coef = summary(m2)$coefficients, data = mtcars, model = m2,
            x_var.name = "wt", y_var.name = "mpg", moderator.name = "hp",
            confidence_interval = TRUE,  CI_Ribbon = FALSE, 
            xlab = "Weight", ylab = "MPG", moderator.lab = "Horsepower") +
ggplot2::theme(text=ggplot2::element_text(family="Times New Roman", size = 16))
# plot the moderating effect with a linear spline
library(lspline)
m3 <- lm(mpg ~ vs + carb + hp + lspline(wt, knots = 4, marginal = FALSE) * hp, data = mtcars)
plot_effect(reg.coef=summary(m3)$coefficients, data = mtcars, model = m3, 
            x_var.name = "wt", y_var.name = "mpg", moderator.name = "hp",
            xlab="Weight", ylab="MPG", moderator.lab="Horsepower") +
ggplot2::theme(text=ggplot2::element_text(family="Times New Roman", size = 16))
Metadata

Version

0.1.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows