Description Usage Arguments Details Value Examples
View source: R/olsdiagnostic.R
Regression diagnostics for a linar regression model.
1 | olsdiagnostic(object, normtest = "Shapiro-Wilk", pval = 0.05)
|
object |
linear regression model from class 'lm' |
normtest |
the type of normality test. Possible test are 'Shapiro-Wilk', 'Jarque-Bera' or 'Anderson-Darling' |
pval |
p-value for the hypothesis test. Default is 0.05 |
olsdiagnostic was developed for the statistical consulting of the University of Göttingen to assist students in checking common assumptions of linear regression quickly and easily. It also provides students with an automated recommendation for the further procedure if an assumption is not fulfilled.
A olsdiagnosticR class with following entries:
Normality_Tests:
This could be the Shapiro-Wilk test, Jarque-Bera test, Anderson-Darling test or Cramer-von-mises test. Further information can be found in the documentation:
Shapiro_Wilk_test
jarque_bera
anderson_darling_test
Outlier:
Possible.Outlier: a data.frame with possible outlier
Cooks.Distance: a vector with the cook's distance values
Hat.Values a vector with the lavarage values
Studentized.Residuals a vector with the studentized residuals
Standardized.Residuals a vector with the standardized residuals
Further information can for these values be found in the documentation:
influence_observation
Multicollinearity:
VIF: a vector of the variance inflation factors Further information can be found in the documentation:
VIF
Contain.Columns: A string with the columns that would be avoid multicollinearity in the data
Heteroskedasticity:
A Breusch-Pagan 'htest' object.
Further information can be found in the documentation:
bp_test
Plots:
QQ_Plot: qq_plot
Residual_Hist: resid_hist
Box_Plot_X: box_plot_x
Regressor_hist: hist_x
Cooks_Distance_Plot: plot_cd
Bubble_Plot: influence_plot
Spread_Level_Plot: influence_plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
e_norm <- rnorm(n)
e_exp <- rexp(n)
x1 = rnorm(n = n, mean = 80, sd = 10)
x2 = rnorm(n = n, mean = 70, sd = 5)
x3 = 2 * x1 + 4 * x2 + rnorm(n, mean = 20, sd = 5)
y_n = 3 + x1 + x2 + e_norm
y_m_e = 4 + x1 + x2 + x3 + e_exp
mod_n <- lm(y_n ~ x1 + x2)
mod_m_e <- lm(y_m_e ~ x1 + x2 + x3)
olsdiagnosticR::olsdiagnostic(mod_n)
olsdiagnosticR::olsdiagnostic(mod_m_e, normtest = 'Jarque-Bera')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.