Nimmi Kalapurackal
asked on
Query on linear model function parameters
How is
model <- lm(
formula = Petal.Width ~ Petal.Length,
data = iris
)
different from
model <- lm(
formula = iris$Petal.Width ~ iris$Petal.Length,
data = iris
)
The output of both the commands are same but my prediction output differs.
NOTE: I had assumed Petal.Width is same as iris$Petal.Width, clearly they are not. I don't understand how are they different.
Attached RScript contains complete code
model <- lm(
formula = Petal.Width ~ Petal.Length,
data = iris
)
different from
model <- lm(
formula = iris$Petal.Width ~ iris$Petal.Length,
data = iris
)
The output of both the commands are same but my prediction output differs.
NOTE: I had assumed Petal.Width is same as iris$Petal.Width, clearly they are not. I don't understand how are they different.
Attached RScript contains complete code
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.