Description Usage Arguments Details Value Author(s) Examples
Generic function for obtaining scaled coefficients
1 | scaleB(object, scale.response = F)
|
object |
an object resulting from glm, lm, or lda |
scale.response |
should the response variable be scaled as well? (Usually not for glm or lda). |
Given an object of class lm, glm, or lda, this function will first standardize the variables, then run the model again. The resulting coefficients will be standardized betas.
an object of the same class as the one outputted
Dustin Fife
1 2 3 4 5 6 7 8 9 10 11 12 | #### create random data with different means and variances
d = data.frame(matrix(rnorm(5*50, c(10,5,14,100, 33), c(3,5,4,3,5)), nrow=50, byrow=TRUE))
names(d) = LETTERS[1:5]
g = lm(C~B + A + D + E, data=d)
scaleB(g, TRUE)
##### make a logistic
d$A = as.factor(as.numeric(cut(d$A, 2, labels=c(1,0)) ))
object = glm(A~B + C + D + E, data=d, family=binomial)
scaleB(object)
##### LDA
object = lda(A~B + C + D + E, data=d, family=binomial)
scaleB(object)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.