# Multiple R square: 0,4324, R squared fitted: 0,4121 # Residual standard error: 17.31 in 28 degrees of freedom error the higher the t-score and the t-score comes with a p-value because its distribution The p-value is how statistically significant the variable is for the model for a confidence level of the 95% we will compare this value with alpha which will be 0.05, so in our case the p-value of the intersection and the Age is less than alpha (alfa = 0.05), this implies that both are statistically significant for our model. Value T: the t-value is the coefficient divided by the standard error, it is basically how big is estimated in relation to the error, the greater the coefficient in relation to Std. Standard error It is the expected variability in the coefficient that captures the sampling variability, so the variation in the intersection can be up to 10.0005 and the variation in Age will be 0.2102 no more than that It means that a change in one unit in age will bring 0.9709 units to change in blood pressure. Interpretation of the model # Coefficients: # Residual standard error: 17.31 on 28 degrees of freedom The lm function () has two attributes, first is a formula where we will use “BP ~ Age” because age is an independent variable and blood pressure is a dependent variable and the second is data, where we will give the name of the data frame that contains data which in this case is the bp data frame. Now, with the help of the lm function (), we are going to make a linear model. 0,6575673 Create a linear regression model We can also verify our previous analysis that there is a correlation between blood pressure and age by taking the help of the function cor () in R which is used to calculate the correlation between two variables. Calculate the correlation between age and blood pressure It is quite evident from the graph that the distribution on the graph is scattered in such a way that we can fit a straight line through the points. Taking the help of the ggplot2 library in R, we can see that there is a correlation between blood pressure and age, as we can see that increasing age is followed by an increase in blood pressure. p <- as.ame(53)Ĭolnames(p) <- "Age" Creating a scatter plot using the ggplot2 library And this data frame will be used to predict blood pressure at 53 years after creating a linear regression model. Import an Age vs Blood Pressure dataset that is a CSV file using the read.csv function () in R and store this dataset in a bp dataframe.īp <- read.csv ('bp.csv') Create data frame to predict valuesĬreation of a data frame that will store the age of 53 years. Regression line equation in our data set.īP = 98,7147 + 0,9709 Age Importing dataset The line of best fit would be of the form:ī0 and B1 – Regression parameter Prediction of blood pressure by age by regression in R Linear regression basically consists of fitting a straight line to our data set so that we can predict future events. The above prediction idea sounds magical, but it's pure statistics. Note that we are not calculating the dependence of the dependent variable on the independent variable, just the association.įor instance, a company is investing a certain amount of money in marketing a product and has also collected sales data over the years by analyzing the correlation in marketing budget and sales data, we can predict next year's sale if the company allocates a certain amount of money for the marketing department. The two variables involved are a dependent variable that responds to change and the independent variable. Simple linear regression analysis is a technique to find the association between two variables. Practical application of linear regression using R.īlood pressure and age dataset application. Importance of linear regression in predictive analysis.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |