For illustration purpose lets construct some datasets with a three vectors (y,x,z)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
y = c(seq(1,200,by=2)) | |
x = c(seq(1,404,by=4)) | |
z = c(seq(100,200,by=1)) | |
#x*z is new interaction variable | |
p = x*z | |
model = lm(y~x+p) | |
#Validating the model | |
plot(model$fitted.values, model$residual.values) | |
#Has some pattern (Failure - Not convincing representation) | |
hist(model$residuals) | |
#Left skewed Histogram of normal distribution (ok ok) |
Happy Learning!!!
No comments:
Post a Comment