(R statistics)
My question is regarding this warning. My data contains patients and healthy subjects. Exponential decay is my outcome measure.
I have a example dataset here
I managed to run bayesglm and firth method with brglm. However, I wanted to try the regular glm while this is easier to write down in a paper.
I found out that because of the high numbers >100 seconds, the quasi separation warning arises (kinda makes sense, while the slope of propability will exceed a near vertical line).
To test this, I calculated the mean + (6*std) of the healthy subjects and replaced the values of the patients exceeding this value with this value. Now the warnings are gone.
They more or less give the same ROC-curve as the bayesglm and firth's method.
However, I do not know if this is a valid method to "arbitrarily" change values. Maybe non-parametric ranking is in place instead of using the actual values to undermine this problem or changing it to log values.
Hope somebody can give me a valid solution in order to write my paper.
Moreover, how do I present values that are infinite, like mean+/-SD is not possible ofcourse! Thanks in advance!
Data:
column [1]= Type (healthy=0,patient=1).
column [2]= decay.
column [3]= if the value is higer than mean(health)+(6*std(health)) it was replaced by this value.
# STACK EXCHANGE
library("caret")
library("ROCR")
library("readxl")
stackdata <- read_excel("STACK.xlsx",sheet = "DATA")
stackdata$type <- as.factor(stackdata$type)
levels(stackdata$type)<-c('H','P')
head(stackdata)
set.seed(777)
partitionRule<-createDataPartition(stackdata$type,p=0.7,list=F)
trainingSet<-stackdata[partitionRule,]
testingSet<-stackdata[-partitionRule,]
splitRule<-trainControl(method="repeatedcv",repeats=3, savePredictions=TRUE, classProbs=TRUE, number=5, p=0.7, summaryFunction=twoClassSummary, returnResamp = "all")
## GLM with extreme values
glmModel<-train(type~decay,data=stackdata,method="glm",family=binomial(logit),trControl=splitRule, metric="ROC")
glmTest<-predict(glmModel,newdata=testingSet,type="raw")
confusionMatrix(data=glmTest,testingSet$type)
ROC_glmModel <- roc(as.numeric(glmModel$trainingData$.outcome=='P'),aggregate(P~rowIndex,glmModel$pred,mean)[,'P'])
ROC_mean95_plot <- plot.roc(ROC_glmModel$response,ROC_glmModel$predictor)
Youden_coords_mean95 <- coords(ROC_mean95_plot, "b", ret="t", best.method="youden")
## GLM mean+(6*std) of the healthy subjects
glmModel<-train(type~decay6std,data=stackdata,method="glm",family=binomial(logit),trControl=splitRule, metric="ROC")
glmTest<-predict(glmModel,newdata=testingSet,type="raw")
confusionMatrix(data=glmTest,testingSet$type)
ROC_glmModel <- roc(as.numeric(glmModel$trainingData$.outcome=='P'),aggregate(P~rowIndex,glmModel$pred,mean)[,'P'])
ROC_mean95_plot <- plot.roc(ROC_glmModel$response,ROC_glmModel$predictor)
Youden_coords_mean95 <- coords(ROC_mean95_plot, "b", ret="t", best.method="youden")
```
decay
then you might consider analyzing this as a survival model, withdecay
the response variable andpatient/normal
as the predictor. $\endgroup$decay
the only predictor that you have for distinguishing healthy/patient, or are there additional predictors (e.g., age, sex, BMI,...) that you intend to include in your model? $\endgroup$