SHARE
TWEET

Untitled

a guest Jun 15th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. d <- data.frame(x = rnorm(100, 0, 1),
  2.             y = rnorm(100, 0, 1),
  3.             z = rnorm(100, 0, 1))
  4.      
  5. func <-function(d){
  6.   fit1 <- lm( y~ x + z, data = d)
  7.   fit2 <- lm( y~x + I(z^2), data = d)
  8.   fit3 <- lm( y~poly(x,3) + z, data = d)
  9.   fit4 <- lm( y~ns(x, 3) + z, data = d)
  10.   l <- list(fit1, fit2, fit3, fit4, fit5)
  11.   names(l) <- paste0("fit", 1:5)
  12.   return(l)
  13. }
  14.  
  15. mods <- func(d)
  16. mods[[1]]
  17.  
  18. stargazer(mods, type="text)
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