public
Created

apsrtable

  • Download Gist
apsrtable.r
R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
doInstall <- TRUE
toInstall <- c("apsrtable")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
 
#http://cran.r-project.org/web/packages/apsrtable/apsrtable.pdf
 
 
library(apsrtable)
 
X1 <- rnorm(1000)
X2 <- rnorm(1000)
X3 <- rnorm(1000)
X4 <- rnorm(1000)
#Create a relationship to Model:
Y <- X1 + 1.8*X2 -.12*X3 + 1.8*X4 + rnorm(1000)
 
Model.1 <- lm(Y ~ X1 + X2)
Model.2 <- lm(Y ~ X1 + X3)
Model.3 <- lm(Y ~ X1 + X2 + X3)
Model.4 <- lm(Y ~ X1 + X2 + X3 + X4)
 
apsrtable(Model.1, Model.2, Model.3, Model.4, model.names=c("Model 1" , "Second Try", "Model 3", "My Fourth Model"))
 
apsrtable(Model.1, Model.2, Model.3, Model.4, lev=.30,
model.names=c("Model 1" , "Second Try", "Model 3", "My Fourth Model"),
coef.names=c("Intercept", "Some Variables", "That Might", "Be Of", "Interest to You"))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.