rlevel: Changing the Reference Group without Re-Running the Model

Description Usage Arguments Details Value Examples

Description

To re-calculate the coefficients and the standard deviation when changing the reference group.

Usage

1
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

1
2
3
4
5
6
7
# 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"))

CRWRM documentation built on May 2, 2019, 5:56 a.m.

Related to rlevel in CRWRM...