SHARE
TWEET

Untitled

a guest Jun 25th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library(dplyr)
  2. library(qgam)
  3. library(mgcv)
  4. data(UKload)
  5. test <- gam(
  6.   NetDemand ~ te(wM, Posan, by = Year),
  7.   data = UKload %>% mutate(Year = as.factor(Year))
  8. )
  9.      
  10. library(visreg)
  11. test2 <- gam(
  12.   NetDemand ~ s(wM, by = Year),
  13.   data = UKload %>% mutate(Year = as.factor(Year))
  14. )
  15. visreg(test2, xvar = "wM", by = "Year")
  16.      
  17. visreg2d(test, xvar = "wM", yvar = "Posan", by = "Year")
  18.      
  19. vis.gam(test, plot.type = "contour", cond = list(Year = 2011))
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