Home » date » 2008 » Jan » 30 » attachments

Binghnetty Logistic Regression 5 (females)

R Software Module: rwasp_logisticregression.wasp (opens new window with default values)
Title produced by software: Bias-Reduced Logistic Regression
Date of computation: Wed, 30 Jan 2008 05:03:28 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2008/Jan/30/t1201694703zbogz9we59dzn24.htm/, Retrieved Wed, 30 Jan 2008 13:05:03 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
1 68.7 1 5.29 1 67.5 1 4.6 1 68.9 1 5.86 1 70.5 1 6.4 1 73.5 1 4.48 1 68.1 1 3.1 1 66.7 1 3.79 1 69.3 1 5.73 1 67.5 1 3.57 1 67.8 1 3.63 1 69.4 1 6.07 1 68.8 1 5.33 1 71.7 1 4.28 1 67 1 6.45 1 70.5 1 6.23 1 76.5 1 6.9 1 73.8 1 7.21 1 71.2 1 6.55 1 82.3 1 5.73 1 72.5 1 6.81 1 67.3 1 2.18 1 72.7 1 2.17 1 69.6 1 4.05 1 74.8 1 5.23 1 71.2 1 5.76 1 72.4 1 5.17 1 83.2 1 5.58 1 65.6 1 5.7 1 79.6 1 4.35 1 66.2 1 5.44 1 68.6 1 6.08 1 65.8 1 6.48 1 82.9 1 4.65 1 88 1 6.75 1 76.6 1 6.28 1 70.7 1 3.76 1 77.3 1 3.06 1 65.5 1 6.49 1 68.5 1 7.1 1 77.1 1 1.01 1 82.3 0 4.92 1 80.7 0 5.75 1 74.4 0 5.55 1 71.2 0 4.86 1 71.1 0 5.24 1 69.5 0 6.99 0 65 1 5 0 65 1 8 0 65 0 6 0 65 1 5 0 65 1 8 0 65 0 10 0 65 1 1 0 65 1 7 0 65 1 6 0 65 1 4 0 65 0 6 0 65 0 6 0 65 1 8 0 65 0 7 0 65 0 6 0 65 1 7 0 65 1 6 0 65 1 6 0 65 0 6 0 65 1 5 0 65 1 6 0 65 1 7 0 65 1 6 0 65 1 3 0 65 1 6 0 65 1 3 0 65 1 7 0 65 1 5 0 65 1 7 0 65 1 5 0 65 1 7 0 65 1 7 0 65 1 6 0 65 1 7 0 65 1 5 0 65 1 6 0 65 1 6 0 65 1 6 0 65 1 5 0 65 1 8 0 65 0 3 0 65 0 5 0 65 0 6 0 65 0 6 0 65 1 6 0 65 0 9 0 65 1 8 0 65 1 8 0 65 0 4 0 65 1 9 0 65 1 5 0 65 0 6 0 65 1 9 0 65 1 6 0 65 1 6 0 65 1 7 0 65 1 5 0 65 0 9 0 65 1 6 0 65 1 6 0 65 0 6 0 65 1 7 0 65 0 8 0 65 0 7 0 65 1 6 0 65 2 6 0 65 1 5 0 65 1 7 0 65 1 6 0 65 0 7 0 65 1 9 0 65 1 6 0 65 1 7 0 65 1 6 0 65 1 7 0 65 1 7 0 65 0 8 0 65 1 4 0 65 0 5 0 65 1 6 0 65 1 6 0 65 1 6 0 65 1 7
 
Text written by user:
 
Output produced by software:

Enter (or paste) a matrix (table) containing all data (time) series. Every column represents a different variable and must be delimited by a space or Tab. Every row represents a period in time (or category) and must be delimited by hard returns. The easiest way to enter data is to copy and paste a block of spreadsheet cells. Please, do not use commas or spaces to seperate groups of digits!


Summary of compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time5 seconds
R Server'Herman Ole Andreas Wold' @ 193.190.124.10:1001


Coefficients of Bias-Reduced Logistic Regression
VariableParameterS.E.t-stat2-sided p-value
(Intercept)-221.28697877782077.7326521514536-2.846769956422770.00516414207316163
age3.356324211084791.189967864137082.820516681363220.00557808145767424
snoring0.482544078929951.247325553602820.3868629785833790.699515465804962
sleep_time-0.04265307437711270.342438817520885-0.1245567739250570.901074534645852


Summary of Bias-Reduced Logistic Regression
Deviance15.8555945340391
Penalized deviance12.9260558629309
Residual Degrees of Freedom125
ROC Area1


Fit of Logistic Regression
IndexActualFittedError
110.9999287613521817.12386478189941e-05
210.9961323976358240.00386760236417627
310.9999626953932773.73046067229099e-05
410.9999998223486091.77651391042311e-07
510.9999999999930646.93589630174074e-12
610.999514098954340.000485901045659376
710.947882760048920.05211723995108
810.9999903102380899.68976191140225e-06
910.9962980179927050.00370198200729477
1010.99864082346790.00135917653210027
1110.9999929717190827.028280917587e-06
1210.999948984505325.10154946808949e-05
1310.99999999710842.89159929334204e-09
1410.9779937142424780.0220062857575221
1510.9999998236321041.76367895954321e-07
16113.33066907387547e-16
1710.9999999999971532.84694490204629e-12
1810.9999999829390141.70609858463067e-08
19110
2010.9999999997802662.19734008766181e-10
2110.9931945378364760.00680546216352351
2210.9999999999078669.2133856099963e-11
2310.99999670461893.29538109944405e-06
2410.9999999999999099.12603326241879e-14
2510.9999999835043221.64956778236913e-08
2610.9999999997133972.86603407673169e-10
27110
2810.2946950903109460.705304909689054
29110
3010.7599116781678030.240088321832197
3110.9998969378709330.000103062129067411
3210.4415944579123790.558405542087621
33110
34110
35112.22044604925031e-16
3610.9999999188779928.11220077778785e-08
37110
3810.2240850362339340.775914963766066
3910.9998494307599680.000150569240031651
40110
41110
42110
4310.9999999999994265.73652236823818e-13
4410.9999999742803652.57196348663058e-08
4510.9999999634348623.65651382505661e-08
4610.9999915337032888.46629671191756e-06
4700.0543398017565514-0.0543398017565514
4800.0481271236411846-0.0481271236411846
4900.0328683797745128-0.0328683797745128
5000.0543398017565514-0.0543398017565514
5100.0481271236411846-0.0481271236411846
5200.0278565350397756-0.0278565350397756
5300.0638036965089954-0.0638036965089954
5400.0501191921834295-0.0501191921834295
5500.0521891951873008-0.0521891951873008
5600.05657374053984-0.05657374053984
5700.0328683797745128-0.0328683797745128
5800.0328683797745128-0.0328683797745128
5900.0481271236411846-0.0481271236411846
6000.0315392064913704-0.0315392064913704
6100.0328683797745128-0.0328683797745128
6200.0501191921834295-0.0501191921834295
6300.0521891951873008-0.0521891951873008
6400.0521891951873008-0.0521891951873008
6500.0328683797745128-0.0328683797745128
6600.0543398017565514-0.0543398017565514
6700.0521891951873008-0.0521891951873008
6800.0501191921834295-0.0501191921834295
6900.0521891951873008-0.0521891951873008
7000.0588937982490979-0.0588937982490979
7100.0521891951873008-0.0521891951873008
7200.0588937982490979-0.0588937982490979
7300.0501191921834295-0.0501191921834295
7400.0543398017565514-0.0543398017565514
7500.0501191921834295-0.0501191921834295
7600.0543398017565514-0.0543398017565514
7700.0501191921834295-0.0501191921834295
7800.0501191921834295-0.0501191921834295
7900.0521891951873008-0.0521891951873008
8000.0501191921834295-0.0501191921834295
8100.0543398017565514-0.0543398017565514
8200.0521891951873008-0.0521891951873008
8300.0521891951873008-0.0521891951873008
8400.0521891951873008-0.0521891951873008
8500.0543398017565514-0.0543398017565514
8600.0481271236411846-0.0481271236411846
8700.0371882778641705-0.0371882778641705
8800.0342515879813616-0.0342515879813616
8900.0328683797745128-0.0328683797745128
9000.0328683797745128-0.0328683797745128
9100.0521891951873008-0.0521891951873008
9200.0290351606044783-0.0290351606044783
9300.0481271236411846-0.0481271236411846
9400.0481271236411846-0.0481271236411846
9500.0356908579155549-0.0356908579155549
9600.0462103811931719-0.0462103811931719
9700.0543398017565514-0.0543398017565514
9800.0328683797745128-0.0328683797745128
9900.0462103811931719-0.0462103811931719
10000.0521891951873008-0.0521891951873008
10100.0521891951873008-0.0521891951873008
10200.0501191921834295-0.0501191921834295
10300.0543398017565514-0.0543398017565514
10400.0290351606044783-0.0290351606044783
10500.0521891951873008-0.0521891951873008
10600.0521891951873008-0.0521891951873008
10700.0328683797745128-0.0328683797745128
10800.0501191921834295-0.0501191921834295
10900.0302621021122409-0.0302621021122409
11000.0315392064913704-0.0315392064913704
11100.0521891951873008-0.0521891951873008
11200.0819054125547117-0.0819054125547117
11300.0543398017565514-0.0543398017565514
11400.0501191921834295-0.0501191921834295
11500.0521891951873008-0.0521891951873008
11600.0315392064913704-0.0315392064913704
11700.0462103811931719-0.0462103811931719
11800.0521891951873008-0.0521891951873008
11900.0501191921834295-0.0501191921834295
12000.0521891951873008-0.0521891951873008
12100.0501191921834295-0.0501191921834295
12200.0501191921834295-0.0501191921834295
12300.0302621021122409-0.0302621021122409
12400.05657374053984-0.05657374053984
12500.0342515879813616-0.0342515879813616
12600.0521891951873008-0.0521891951873008
12700.0521891951873008-0.0521891951873008
12800.0521891951873008-0.0521891951873008
12900.0501191921834295-0.0501191921834295


Type I & II errors for various threshold values
ThresholdType IType II
0.0101
0.0201
0.0300.963855421686747
0.0400.746987951807229
0.0500.63855421686747
0.0600.0240963855421687
0.0700.0120481927710843
0.0800.0120481927710843
0.0900
0.100
0.1100
0.1200
0.1300
0.1400
0.1500
0.1600
0.1700
0.1800
0.1900
0.200
0.2100
0.2200
0.230.02173913043478260
0.240.02173913043478260
0.250.02173913043478260
0.260.02173913043478260
0.270.02173913043478260
0.280.02173913043478260
0.290.02173913043478260
0.30.04347826086956520
0.310.04347826086956520
0.320.04347826086956520
0.330.04347826086956520
0.340.04347826086956520
0.350.04347826086956520
0.360.04347826086956520
0.370.04347826086956520
0.380.04347826086956520
0.390.04347826086956520
0.40.04347826086956520
0.410.04347826086956520
0.420.04347826086956520
0.430.04347826086956520
0.440.04347826086956520
0.450.06521739130434780
0.460.06521739130434780
0.470.06521739130434780
0.480.06521739130434780
0.490.06521739130434780
0.50.06521739130434780
0.510.06521739130434780
0.520.06521739130434780
0.530.06521739130434780
0.540.06521739130434780
0.550.06521739130434780
0.560.06521739130434780
0.570.06521739130434780
0.580.06521739130434780
0.590.06521739130434780
0.60.06521739130434780
0.610.06521739130434780
0.620.06521739130434780
0.630.06521739130434780
0.640.06521739130434780
0.650.06521739130434780
0.660.06521739130434780
0.670.06521739130434780
0.680.06521739130434780
0.690.06521739130434780
0.70.06521739130434780
0.710.06521739130434780
0.720.06521739130434780
0.730.06521739130434780
0.740.06521739130434780
0.750.06521739130434780
0.760.08695652173913040
0.770.08695652173913040
0.780.08695652173913040
0.790.08695652173913040
0.80.08695652173913040
0.810.08695652173913040
0.820.08695652173913040
0.830.08695652173913040
0.840.08695652173913040
0.850.08695652173913040
0.860.08695652173913040
0.870.08695652173913040
0.880.08695652173913040
0.890.08695652173913040
0.90.08695652173913040
0.910.08695652173913040
0.920.08695652173913040
0.930.08695652173913040
0.940.08695652173913040
0.950.1086956521739130
0.960.1086956521739130
0.970.1086956521739130
0.980.1304347826086960
0.990.1304347826086960
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t1201694703zbogz9we59dzn24/1vwlo1201694600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t1201694703zbogz9we59dzn24/1vwlo1201694600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t1201694703zbogz9we59dzn24/2s4ev1201694600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t1201694703zbogz9we59dzn24/2s4ev1201694600.ps (open in new window)


 
Parameters (Session):
 
Parameters (R input):
 
R code (references can be found in the software module):
library(brlr)
roc.plot <- function (sd, sdc, newplot = TRUE, ...)
{
sall <- sort(c(sd, sdc))
sens <- 0
specc <- 0
for (i in length(sall):1) {
sens <- c(sens, mean(sd >= sall[i], na.rm = T))
specc <- c(specc, mean(sdc >= sall[i], na.rm = T))
}
if (newplot) {
plot(specc, sens, xlim = c(0, 1), ylim = c(0, 1), type = 'l',
xlab = '1-specificity', ylab = 'sensitivity', main = 'ROC plot', ...)
abline(0, 1)
}
else lines(specc, sens, ...)
npoints <- length(sens)
area <- sum(0.5 * (sens[-1] + sens[-npoints]) * (specc[-1] -
specc[-npoints]))
lift <- (sens - specc)[-1]
cutoff <- sall[lift == max(lift)][1]
sensopt <- sens[-1][lift == max(lift)][1]
specopt <- 1 - specc[-1][lift == max(lift)][1]
list(area = area, cutoff = cutoff, sensopt = sensopt, specopt = specopt)
}
roc.analysis <- function (object, newdata = NULL, newplot = TRUE, ...)
{
if (is.null(newdata)) {
sd <- object$fitted[object$y == 1]
sdc <- object$fitted[object$y == 0]
}
else {
sd <- predict(object, newdata, type = 'response')[newdata$y ==
1]
sdc <- predict(object, newdata, type = 'response')[newdata$y ==
0]
}
roc.plot(sd, sdc, newplot, ...)
}
hosmerlem <- function (y, yhat, g = 10)
{
cutyhat <- cut(yhat, breaks = quantile(yhat, probs = seq(0,
1, 1/g)), include.lowest = T)
obs <- xtabs(cbind(1 - y, y) ~ cutyhat)
expect <- xtabs(cbind(1 - yhat, yhat) ~ cutyhat)
chisq <- sum((obs - expect)^2/expect)
P <- 1 - pchisq(chisq, g - 2)
c('X^2' = chisq, Df = g - 2, 'P(>Chi)' = P)
}
x <- as.data.frame(t(y))
r <- brlr(x)
summary(r)
rc <- summary(r)$coeff
bitmap(file='test0.png')
ra <- roc.analysis(r)
dev.off()
te <- array(0,dim=c(2,99))
for (i in 1:99) {
threshold <- i / 100
numcorr1 <- 0
numfaul1 <- 0
numcorr0 <- 0
numfaul0 <- 0
for (j in 1:length(r$fitted.values)) {
if (y[1,j] > 0.99) {
if (r$fitted.values[j] >= threshold) numcorr1 = numcorr1 + 1 else numfaul1 = numfaul1 + 1
} else {
if (r$fitted.values[j] < threshold) numcorr0 = numcorr0 + 1 else numfaul0 = numfaul0 + 1
}
}
te[1,i] <- numfaul1 / (numfaul1 + numcorr1)
te[2,i] <- numfaul0 / (numfaul0 + numcorr0)
}
bitmap(file='test1.png')
op <- par(mfrow=c(2,2))
plot((1:99)/100,te[1,],xlab='Threshold',ylab='Type I error', main='1 - Specificity')
plot((1:99)/100,te[2,],xlab='Threshold',ylab='Type II error', main='1 - Sensitivity')
plot(te[1,],te[2,],xlab='Type I error',ylab='Type II error', main='(1-Sens.) vs (1-Spec.)')
plot((1:99)/100,te[1,]+te[2,],xlab='Threshold',ylab='Sum of Type I & II error', main='(1-Sens.) + (1-Spec.)')
par(op)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Coefficients of Bias-Reduced Logistic Regression',5,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Variable',header=TRUE)
a<-table.element(a,'Parameter',header=TRUE)
a<-table.element(a,'S.E.',header=TRUE)
a<-table.element(a,'t-stat',header=TRUE)
a<-table.element(a,'2-sided p-value',header=TRUE)
a<-table.row.end(a)
for (i in 1:length(rc[,1])) {
a<-table.row.start(a)
a<-table.element(a,labels(rc)[[1]][i],header=TRUE)
a<-table.element(a,rc[i,1])
a<-table.element(a,rc[i,2])
a<-table.element(a,rc[i,3])
a<-table.element(a,2*(1-pt(abs(rc[i,3]),r$df.residual)))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Summary of Bias-Reduced Logistic Regression',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Deviance',1,TRUE)
a<-table.element(a,r$deviance)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Penalized deviance',1,TRUE)
a<-table.element(a,r$penalized.deviance)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Residual Degrees of Freedom',1,TRUE)
a<-table.element(a,r$df.residual)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'ROC Area',1,TRUE)
a<-table.element(a,ra$area)
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Fit of Logistic Regression',4,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Index',1,TRUE)
a<-table.element(a,'Actual',1,TRUE)
a<-table.element(a,'Fitted',1,TRUE)
a<-table.element(a,'Error',1,TRUE)
a<-table.row.end(a)
for (i in 1:length(r$fitted.values)) {
a<-table.row.start(a)
a<-table.element(a,i,1,TRUE)
a<-table.element(a,y[1,i])
a<-table.element(a,r$fitted.values[i])
a<-table.element(a,y[1,i]-r$fitted.values[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable2.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Type I & II errors for various threshold values',3,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Threshold',1,TRUE)
a<-table.element(a,'Type I',1,TRUE)
a<-table.element(a,'Type II',1,TRUE)
a<-table.row.end(a)
for (i in 1:99) {
a<-table.row.start(a)
a<-table.element(a,i/100,1,TRUE)
a<-table.element(a,te[1,i])
a<-table.element(a,te[2,i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable3.tab')
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by