normality test OF RESIDUAL in R
in the nortest package
shapiro.test(mod3$residuals)
Shapiro-Wilk normality test
data: mod3$residuals
W = 0.95036, p-value = 0.04473
The code above generates data from a normal distribution (command “rnorm”), reshapes it into a series of columns, and runs what is called a normal quantile-quantile plot (QQ Plot, for short) on the first column.The Q-Q plot tells us what proportion of the data set (in this case, the first column of variable x), compares with the expected proportion (theoretically) of the normal distribution model based on the sample’s mean and standard deviation. We’re able to do this, because of the normal distribution’s properties. The normal distribution is thicker around the mean, and thinner as you move away from it – specifically, around 68% of the points you can expect to see in normally distributed data will only be 1 standard deviation away from the mean. There are similar metrics for normally distributed data, for 2 and 3 standard deviations (95.4% and 99.7% respectively).
in the nortest package
shapiro.test(mod3$residuals)
Shapiro-Wilk normality test
data: mod3$residuals
W = 0.95036, p-value = 0.04473
NORMAL Q-Q PLOTS
plot(mod3)
press enter 4 times to get 4 different graph
Graphical method
ReplyDeletepar(mfrow=c(2,2)) # init 4 charts in 1 panel
plot(lmMod)