In: Statistics and Probability
how do you test for regression in R studio with variables x and y
Solution:
Suppose we have two variables x and y under consideration. The variable x denotes the independent variable and the variable y denotes the dependent variable.
The R-code to test for regression is:
x<-c(16.8,18.3,19.1,17.2)
y<-c(11.7,14.4,14.5,13.4)
model<-lm(y~x)
summary(model)
The R-output is:
To test for the regression, we can look for the p-value. The p-value in the above output is 0.1152, which is greater than the significance level (say 0.05). We, therefore, can conclude that the model is not significant at 0.05 significance level