Thursday, March 11, 2021

How to make a simple multilinear regresion model with R.

 We will use the dataset from https://drive.google.com/file/d/0BxQfpNgXuWoIWkl4M3dMZDFtUkU/view


Step 1

we call the dataset lungcap.csv


Step2

>>> file<-read.delim("C:/Users/Owner/Downloads/lungcap.csv", header=TRUE, sep = ',')

>>> attach(file)    # this appends the header variables like Age, Gender, ....



Step3

The model is below

>>> model1 <- lm(LungCap ~ Age + Height)

>>> summary(model1)




Step4

We produce the confidence intervals with 

>>> confint(model1, conf.level = 0.95)


##Interpretation of model: the model thell us that there is a strong linear relation with Height and Lung # Capacity. Thus, the p value is smaller than 0.001. And it is significant.    

Step 5 
We just plot the linear regression for each variable

>plot(Height, LungCap)



For more help leave me a question and I could help you with troubleshooting. 


No comments:

Post a Comment