Nothing
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup--------------------------------------------------------------------
library(dScoreTest)
## ----gof-wellspec-------------------------------------------------------------
set.seed(3)
n <- 300
dat <- data.frame(x1 = rnorm(n), x2 = rnorm(n))
dat$y <- 1 + dat$x1 + dat$x2 + rnorm(n)
fit <- lm(y ~ x1 + x2, data = dat)
gof_test(fit)
## ----gof-misspec--------------------------------------------------------------
dat$y2 <- 1 + dat$x1 + dat$x1^2 + dat$x2 + rnorm(n)
fit.mis <- lm(y2 ~ x1 + x2, data = dat)
gof_test(fit.mis)
## ----compare------------------------------------------------------------------
dat$x1sq <- dat$x1^2
fit.0 <- lm(y2 ~ x1 + x2, data = dat) # null (linear)
fit.1 <- lm(y2 ~ x1 + x1sq + x2, data = dat) # alternative (superset)
compare_models(fit.0, fit.1)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.