convertmtol {PHInfiniteEstimates} | R Documentation |
Convert a polytomous regression to a conditional logistic regression.
Description
Convert a polytomous regression to a conditional logistic regression.
Usage
convertmtol(xmat, str, yvec, subjects)
Arguments
xmat |
regression matrix |
str |
stratum label |
yvec |
vector of responses |
subjects |
vector of subject labels passed directly to the output. |
Details
Implements version of (Kolassa 2016).
The multinomial regression is converted to a conditional logistic regression, and methods of (Kolassa 1997) may be applied.
This function differs from convertbaselineltolr
of this package in that the former treats the richer data structure of package mlogit
, and this function treats a less complicated structure.
Data in the example is the breast cancer data set breast
of package coxphf
.
Value
a data set on which to apply conditional logistic regression, corresponding to the multinomial regression model.
References
Kolassa JE (1997). “Infinite Parameter Estimates in Logistic Regression.” Scandinavian Journal of Statistics, 24, 523–530. doi:10.1111/1467-9469.00078.
Kolassa JE (2016). “Inference in the Presence of Likelihood Monotonicity for Polytomous and Logistic Regression.” Advances in Pure Mathematics, 6, 331-341. doi:10.4236/apm.2016.65024.
Examples
#Uses data set breast from package coxphf.
data(breast)
out<-convertstoml(Surv(breast$TIME,breast$CENS),breast[,c("T","N","G","CD")])
out1<-convertmtol(out[,c("T","N","G","CD")],out[,"chid"],out[,"choice"],
out[,"patients"])
glmout<-glm.fit(out1$xmat,out1$y,family=binomial())
#In many practice examples, the following line shows which observations to retain
#in the logistic regression example.
moderate<-(fitted(glmout)<1-1.0e-8)&(fitted(glmout)>1.0e-8)
# Proportional hazards fit illustrating infinite estimates.
coxph(Surv(TIME,CENS)~ T+ N+ G+ CD,data=breast)
# Wrong analysis naively removing covariate with infinite estimate
coxph(Surv(TIME,CENS)~ T+ N+ CD,data=breast)
summary(glm((CENS>22)~T+N+G+CD,family=binomial,data=breast))
out2<-reduceLR(out1$xmat,yvec=out1$y,keep="CD")
bestcoxout<-coxph(Surv(TIME,CENS)~ T+ N+ G+ CD,data=breast,
subset=as.numeric(unique(out1$subjects[out2$moderate])))