Last active
January 15, 2020 17:50
-
-
Save davidaarmstrong/d1bef7b5cbbce5f787398b725f6494da to your computer and use it in GitHub Desktop.
Variation in Term Predictions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
predEffects <- function(obj, digits=3){ | |
## obj is a linear model object | |
preds <- predict(obj, type="terms") | |
rg <- apply(preds, 2, range) | |
diff.rg <- apply(rg, 2, diff) | |
out <- data.frame( | |
min = rg[1,], | |
max = rg[2,], | |
diff = diff.rg, | |
iqr = apply(preds, 2, function(x)diff(quantile(x, c(.25,.75)))), | |
sd = apply(preds, 2, sd) | |
) | |
print.data.frame(out, digits=digits) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment