-1

I am trying to calculate the linear regression with interaction for predicting Sepal.Length on both Petal.Length and Species.

picture of my work

I've tried the above in R and I've made sure I'm using the original dataset without changes made to it, but it only shows me intercepts for species versicolor and virginica. How do I find the equation for setosa?

  • 2
    The first level of a categorical variable is called the "reference level". Your Intercept term is for Setosa, and the `Petal.Length` term is the slope for the reference level. The Virginica and Versicolor coefficients reflect those species's differences vs Setosa. You can search more about reference levels in linear regression for more info. – Gregor Thomas Dec 08 '21 at 16:15
  • https://stackoverflow.com/questions/70222280/multiple-regression-with-iris-database – rawr Dec 08 '21 at 16:18

1 Answers1

-1
lm(iris$Sepal.Length ~ iris$Petal.Length + iris$Species - 1)

remove the intercept term.

mrbonewithgale
  • 100
  • 1
  • 7