R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LOGIT)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LOGIT/confusion_stat.Rd_%03d_medium.png", width=480, height=480)
> ### Name: confusion_stat
> ### Title: Display confusion or classification matrix following logistic
> ### regression using glm with binomial family.
> ### Aliases: confusion_stat
> ### Keywords: models
>
> ### ** Examples
>
> library(MASS)
> library(LOGIT)
> data(R84)
> R84$cage <- R84$age - mean(R84$age)
> R84$cdoc <- R84$docvis - mean(R84$docvis)
> mylogit <- glm(outwork ~ cdoc + female + kids + cage + factor(edlevel),
+ family=binomial, data=R84)
> mu <- predict(mylogit, type="response")
> cutpoint<-ROCtest(mylogit, fold=10, type="Sensitivity")$cut
> mu[mu>=cutpoint]<-1
> mu[mu<cutpoint]<-0
> confusion_stat(mu, R84$outwork)
$matrix
obs 0 1 Sum
pred
0 1812 298 2110
1 642 1122 1764
Sum 2454 1420 3874
$statistics
Accuracy Sensitivity Specificity
0.7573567 0.7383863 0.7901408
>
>
>
>
>
> dev.off()
null device
1
>