Course Hero Logo

final Q2.docx - Final Q2 12/5/2020 #Capture a Regression...

This preview shows page 1 - 2 out of 3 pages.

Final Q212/5/2020#Capture a Regression Model with Only Significant Variables.Set thedependent variable to 'Species'. Even though the variable iscategorical and regression is not the proper model to use we willignore this fact for the purpose of the assignment.data =read.csv("iris_exams.csv")str(data)## 'data.frame':300 obs. of6 variables:##$ id: chr"S001" "S002" "S003" "S004" ...##$ Species: chr"setosa" "setosa" "setosa" "setosa" ...##$ Sepal.Length: num4.75 5.07 5.24 5.48 4.9 ...##$ Sepal.Width : num3.3 3.68 3.44 3.96 2.81 ...##$ Petal.Length: num1.44 1.21 1.59 1.53 1.49 ...##$ Petal.Width : num0.235 0.111 0.405 0.272 0.345 ...## 'data.frame':300 obs. of6 variables:##$ id: chr"S001" "S002" "S003" "S004" ...##$ Species: chr"setosa" "setosa" "setosa" "setosa" ...##$ Sepal.Length: num4.75 5.07 5.24 5.48 4.9 ...##$ Sepal.Width : num3.3 3.68 3.44 3.96 2.81 ...##$ Petal.Length: num1.44 1.21 1.59 1.53 1.49 ...##$ Petal.Width : num0.235 0.111 0.405 0.272 0.345 ...data$Species =as.numeric(as.factor(data$Species))model =lm(Species~Petal.Width,data =data)summary(model)#### Call:## lm(formula = Species ~ Petal.Width, data = data)#### Residuals:##Min1QMedian3QMax## -0.68016 -0.12698 -0.004810.121210.77207#### Coefficients:##Estimate Std. Error t value Pr(>|t|)## (Intercept)0.783460.0236233.17<2e-16 ***## Petal.Width1.015220.0165561.33<2e-16 ***## ---## Signif. codes:0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1##

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 3 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
N/A
Tags
Linear Regression, Regression Analysis, Errors and residuals in statistics, xlab, Capture

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture