multreg | R Documentation |
This function allows you to find a multiple linear regression model with several variables, or a categorical predictor with multiple levels.
multreg()
> x = c(1,2,3,4,5,6,7)
> y = c(2.5,5.1,6.4,8.4,10.8,13.4,15.3)
> linreg()
What is the name of the list with your x variable?
x
What is the name of the list with your y variable?
y
The best fit line for these data is:
y = 2.12142857142857 x (x) + 0.357142857142856
You can plot these data by typing:
plot(x,y)
You can find the best fit line by typing:
lm(y~x)
You can add the best fit line to the plot by saving the model:
model = lm(y~x)
and then adding it to the plot:
abline(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.