Title: | Changing the Reference Group without Re-Running the Model |
Version: | 0.0.1 |
Author: | Ziqiang Lin, Eugene M Laska, Carole E Siegel, Wangjian Zhang, Qiaoxuan Lin, Bo Ye. |
Maintainer: | Ziqiang Lin <ziqiang.lin@nyulangone.org> |
Description: | To re-calculate the coefficients and the standard deviation when changing the reference group. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.1.1 |
NeedsCompilation: | no |
Packaged: | 2019-04-27 01:32:42 UTC; LINZ02 |
Repository: | CRAN |
Date/Publication: | 2019-04-27 14:50:03 UTC |
Changing the Reference Group without Re-Running the Model
Description
To re-calculate the coefficients and the standard deviation when changing the reference group.
Usage
rlevel(fit,var,oldrf,newrf,cl=NA)
Arguments
fit |
Fitted model using glm, lm, glmnet or cv.glmnet |
var |
Vector of variable name in the model you plan to change reference |
oldrf |
Vector of old reference group name |
newrf |
Vector of new reference group name |
cl |
Column number of coefficient, only available when using glmnet or cv.glmnet |
Details
Make sure the name of variables, name of old reference, and name of new reference much add quotation marks
Value
New estimation of coefficient with statistics and P value (no statistics and P value for glmnet and cv.glmnet)
Examples
# similated data
relapse <- rbinom(100,1,0.3)
BUP <- c(rep("No",61),rep("Yes",39))
Gender <-sample(c('Male', 'Female'), 100, replace=TRUE)
score <-sample(1:10,100,replace=TRUE)
model=glm(relapse~BUP+Gender+score,family="binomial")
rlevel(model,c("BUP","Gender"),c("No","Female"),c("Yes","Male"))