View source: R/linreg-normality.R
shapiro_wilk_test | R Documentation |
A wrapper around stats::shapiro.test()
that standardizes the inputs and outputs.
shapiro_wilk_test(object, ..., .alpha = 0.05)
## S3 method for class 'lm'
shapiro_wilk_test(object, ..., .alpha = 0.05)
## S3 method for class ''_lm''
shapiro_wilk_test(object, ..., .alpha = 0.05)
## S3 method for class ''_glm''
shapiro_wilk_test(object, ..., .alpha = 0.05)
shapiro_wilk_test_vec(x, ..., .alpha = 0.05)
object |
A model object (such as a fitted |
... |
Not currently used. |
.alpha |
(Optional) Critical p-value used to determine test conclusion. The default is 0.05 (5%). |
x |
For |
The hypotheses for this test are:
Null: Follows a Normal Distribution
Alternative: Does Not Follow a Normal Distribution
A tibble with columns test
, statistic
,
p_value
, result
, outcome
, and .notes
with extra information.
Other normality tests:
anderson_darling_test()
library(tidytest)
#> `lm` Method
mod_lm_fit <- lm(mpg ~ disp + wt + hp, data = mtcars)
shapiro_wilk_test(mod_lm_fit)
#> `linear_reg` Method
library(parsnip)
mod_linreg_fit <- linear_reg() %>%
set_engine("lm") %>%
fit(mpg ~ disp + wt + hp, data = mtcars)
shapiro_wilk_test(mod_linreg_fit)
#> Numeric Method
set.seed(1914)
resids <- rnorm(100)
shapiro_wilk_test_vec(resids)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.