Hi all R-Help ,

After partitioning my data to testing and training (please see below), I
need to estimate the Sensitivity and Specificity. I failed. It would be
appropriate to get your help.

Best regards,
Greg


inTrain <- createDataPartition(y=data$case,
                               p=0.7,
                               list=FALSE)
training <- data[ inTrain,]
testing  <- data[-inTrain,]

attach(training)
#model training and prediction
data_training <- glm(case ~ age+BMI+Calcium+Albumin+meno_1, data =
training, family = binomial(link="logit"))

predict <- predict(data_training, data_predict = testing, type = "response")

predict_testing <- ifelse(predict > 0.5,1,0)

# Sensitivity and Specificity

 
sensitivity<-(predict_testing[2,2]/(predict_testing[2,2]+predict_testing[2,1]))*100
 sensitivity

 
specificity<-(predict_testing[1,1]/(predict_testing[1,1]+predict_testing[1,2]))*100
 specificity

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to