My Coding >
Software >
R >
Regression analysis >
Linear regression analysis with R
Linear regression analysis with R (Page: 2)Go to Page: Our data is cleaned and ready for analysis. We will create Linear regression model with R. COR() - correlation between dataFirst of all we can check, is there are any correlation between these two data with function cor()
And yes, we have negative relation of about -0.6, which mean, that when wind is increasing, the amount of ozone is decreasing. Sign - mean about negative correlation. When one value increase, another value decreasing. Also 0.6 – mean moderate correlation. 0 – means these values are not related at all, and 1 – means these data are perfectly related. Plot linear model between two datasetsFirst of all we will plot this dataset with function plot(). Then can fit linear model with function lm() between these two datasets and then plot this line with abline() function
After this we will have the following plot:
Statistics about our relationsNow it is time to check the statistical information about our model. For this it we need to use summary() from our linear model
It is possible to see what kind of variables are exists in this information for individual call
Prediction from linear modelIf we satisfied with this model, we can make some predictions on the basis of this model. For this we will create data_frame with Wind vector with points of interest and apply our model to dots from this vector with function predict().
|
Last 10 artitles
9 popular artitles
|
|||
© 2020 MyCoding.uk -My blog about coding and further learning. This blog was writen with pure Perl and front-end output was performed with TemplateToolkit. |