Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(3)
- data1 = iris[sample(c(1:dim(iris)[1]), 30), ]
- data2 = iris[sample(c(1:dim(iris)[1]), 50), ]
- model1 = lm(Petal.Length ~ log(Petal.Width),
- data = data1)
- model2 = lm(data2$Petal.Length ~ log(data2$Petal.Width))
- par(mfrow = c(1, 4))
- plot(data1$Petal.Width,
- data1$Petal.Length)
- points(sort(data1$Petal.Width),
- predict(model1, newdata = data1[order(data1$Petal.Width), ]),
- col = "red",
- type = "l")
- plot(data2$Petal.Width,
- data2$Petal.Length)
- points(sort(data2$Petal.Width),
- predict(model1, newdata = data2[order(data2$Petal.Width), ]),
- col = "red",
- type = "l")
- summary(model1)
- summary(model2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement