Multivariate regression
Multiple regression is just as pretty straight forward too, instead of trying to predict by one variable, we predict by using multiple variable, hence multivariate / multiple regression.
In linear regression we use the following formula
y = ax + b
In multiple regression, we need to figure out collective how are other variables affect outcome of a prediction.
So we probably have something like this
y = a + x1b1 + x2b2
where
y is our outcome
b1, b2 is our co-efficient (computed value that are know to influence our model)
x1, x1 are values that we input and see the prediction
To see how this can be used in R, we will see if salary is influence by age, education. To do this lets use the follow codes :
From here, we can see that degree is a strong influence to our salary as compare to age.
Too see, how much a person earn with no degree and age 50 we can use compute as follows :-
This person would probably earn : $ 3797.45
Comments