Linear regression analysis describe the relation between two or more variables,and find the best fit line to the graph and equation of the straight line; that is used for make predictions.
Assumption of Regression Analysis
- Random sampling
- independent measurements or observations.
- Dependent variable should be normally distributed
- equal variance.
R2 = Coefficient of Determination/ Linear Regression coefficients
- SSY = SSREG + SSRES
- SSY = Total variation
- SSREG = Variation explained by regression
- SSRES = Residual variation
- R2 = SREG/SSY
- R2 lie between 0 to 1; if R2 close to 0 points are widely scattered, if R2 close to 1 point lay close to the line.
Note: r 2 = R2 : square of the Pearson correlation = Coefficient of determination / Linear Regression coefficients
Correlation in R
#Conducting the regression analysis and viewing the summary of results
relation = lm(my_data$Y~my_data$X)
summary(relation)
#Drawing the scatter plot
plot(my_data$X, my_data$Y)
abline(relation)