Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // This is a two-point model. So First im predicting rain or no rain (0,1) using logistic regression then using lm model to predict the quantity of rain
  2. mod_LR=glm( Rainfall_LR ~ ., data = train_main[,-8] , family = binomial(link = logit),offset = Pressure)
  3.  
  4. phat <- predict(mod_LR,test_main , type = "response")
  5. pred <- data.frame(test_main)
  6. logols.fit <- lm(log(Rainfall_Next3)~., train_main[train_main$Rainfall_Next3 > 0, -9])
  7.  
  8. pred$logols <- phat * exp(predict(logols.fit, test_main))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement