SHARE
TWEET

Untitled

a guest Aug 19th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set.seed(3)
  2.  
  3. data1 = iris[sample(c(1:dim(iris)[1]), 30), ]
  4. data2 = iris[sample(c(1:dim(iris)[1]), 50), ]
  5.  
  6. model1 = lm(Petal.Length ~ log(Petal.Width),
  7.             data = data1)
  8. model2 = lm(data2$Petal.Length ~ log(data2$Petal.Width))
  9.  
  10. par(mfrow = c(1, 4))
  11. plot(data1$Petal.Width,
  12.      data1$Petal.Length)
  13. points(sort(data1$Petal.Width),
  14.        predict(model1, newdata = data1[order(data1$Petal.Width), ]),
  15.        col = "red",
  16.        type = "l")
  17.  
  18. plot(data2$Petal.Width,
  19.      data2$Petal.Length)
  20. points(sort(data2$Petal.Width),
  21.        predict(model1, newdata = data2[order(data2$Petal.Width), ]),
  22.        col = "red",
  23.        type = "l")
  24.  
  25.  
  26. summary(model1)
  27. summary(model2)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top