Home » date » 2008 » Jan » 30 » attachments

Binghnetty Logistic Regression 3

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 01:59:38 -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/t12016836451ox49wz8atxiqti.htm/, Retrieved Wed, 30 Jan 2008 10:00:45 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
1 1 5.3 2 1 1 4.6 2 1 1 5.9 2 1 1 6.4 2 1 1 4.5 2 1 1 3.1 2 1 1 3.8 2 1 1 5.7 2 1 1 3.6 2 1 1 3.6 2 1 1 6.1 2 1 1 5.3 2 1 1 4.3 2 1 1 6.5 2 1 1 6.2 2 1 1 6.9 2 1 1 7.2 2 1 1 6.6 2 1 1 5.7 2 1 1 6.8 2 1 1 2.2 2 1 1 2.2 2 1 1 4.1 2 1 1 5.2 2 1 1 5.8 2 1 1 5.2 2 1 1 5.6 2 1 1 5.7 2 1 1 4.4 2 1 1 5.4 2 1 1 6.1 2 1 1 6.5 2 1 1 4.7 2 1 1 6.8 2 1 1 6.3 2 1 1 3.8 2 1 1 3.1 2 1 1 6.5 2 1 1 7.1 2 1 1 1.0 2 1 0 4.9 2 1 0 5.8 2 1 0 5.6 2 1 0 4.9 2 1 0 5.2 2 1 0 7.0 2 0 1 5.0 2 0 1 8.0 2 0 0 6.0 2 0 1 5.0 2 0 1 8.0 2 0 0 10.0 2 0 1 1.0 2 0 1 7.0 2 0 1 6.0 2 0 1 4.0 2 0 0 6.0 2 0 0 6.0 2 0 1 8.0 2 0 0 7.0 2 0 0 6.0 2 0 1 7.0 2 0 1 6.0 2 0 1 6.0 2 0 0 6.0 2 0 1 5.0 2 0 1 6.0 2 0 1 7.0 2 0 1 6.0 2 0 1 3.0 2 0 1 6.0 2 0 1 3.0 2 0 1 7.0 2 0 1 5.0 2 0 1 7.0 2 0 1 5.0 2 0 1 7.0 2 0 1 7.0 2 0 1 6.0 2 0 1 7.0 2 0 1 5.0 2 0 1 6.0 2 0 1 6.0 2 0 1 6.0 2 0 1 5.0 2 0 1 8.0 2 0 0 3.0 2 0 0 5.0 2 0 0 6.0 2 0 0 6.0 2 0 1 6.0 2 0 0 99.0 2 0 1 8.0 2 0 1 8.0 2 0 0 4.0 2 0 1 9.0 2 0 1 5.0 2 0 0 6.0 2 0 1 99.0 2 0 1 6.0 2 0 1 6.0 2 0 1 7.0 2 0 1 5.0 2 0 0 99.0 2 0 1 6.0 2 0 1 6.0 2 0 0 6.0 2 0 1 7.0 2 0 0 8.0 2 0 0 7.0 2 0 1 6.0 2 0 2 6.0 2 0 1 5.0 2 0 1 7.0 2 0 1 6.0 2 0 0 7.0 2 0 1 9.0 2 0 1 6.0 2 0 1 7.0 2 0 1 6.0 2 0 1 7.0 2 0 1 7.0 2 0 0 8.0 2 0 1 4.0 2 0 0 5.0 2 0 1 6.0 2 0 1 6.0 2 0 1 6.0 2 0 1 7.0 2 1 1 7.8 1 1 1 6.0 1 1 1 6.0 1 1 1 7.1 1 1 1 5.9 1 1 1 3.6 1 1 1 6.9 1 1 1 8.0 1 1 1 5.6 1 1 1 6.1 1 1 1 5.1 1 1 1 5.0 1 1 1 5.2 1 1 1 2.9 1 1 1 4.9 1 1 1 4.7 1 1 1 6.5 1 1 1 7.5 1 1 1 3.9 1 1 1 3.2 1 1 1 4.5 1 1 1 6.5 1 1 1 7.4 1 1 1 3.3 1 1 1 5.9 1 1 1 4.8 1 1 1 4.4 1 1 1 5.4 1 1 1 5.9 1 1 1 6.1 1 1 1 5.4 1 1 1 6.0 1 1 1 4.9 1 1 1 5.3 1 1 1 6.0 1 1 1 3.2 1 1 1 6.5 1 1 1 3.6 1 1 1 5.9 1 1 1 5.2 1 1 1 7.3 1 1 1 8.9 1 1 1 1.8 1 1 1 6.5 1 1 1 3.0 1 1 1 7.0 1 1 1 7.0 1 1 1 5.9 1 1 1 6.3 1 1 1 3.8 1 1 1 7.6 1 1 1 6.3 1 1 1 5.6 1 1 1 6.4 1 1 1 7.5 1 1 1 7.0 1 1 1 1.1 1 1 1 6.0 1 1 1 6.5 1 1 1 5.7 1 1 1 5.5 1 1 1 6.4 1 1 1 6.5 1 1 1 1.9 1 1 1 3.4 1 1 1 6.4 1 1 1 1.6 1 1 1 6.8 1 1 1 6.1 1 1 1 6.3 1 1 0 5.1 1 1 0 4.7 1 1 0 4.1 1 1 0 3.0 1 1 0 6.5 1 1 0 5.3 1 1 0 6.4 1 1 0 6.8 1 0 1 12.0 1 0 1 7.0 1 0 0 6.0 1 0 1 5.0 1 0 1 7.0 1 0 1 8.0 1 0 0 5.0 1 0 1 8.0 1 0 1 5.0 1 0 1 6.0 1 0 1 9.0 1 0 0 7.0 1 0 1 6.0 1 0 0 6.0 1 0 0 7.0 1 0 0 6.0 1 0 0 6.0 1 0 0 8.0 1 0 0 7.0 1 0 0 5.0 1 0 0 7.0 1 0 0 7.0 1 0 1 6.0 1 0 1 5.0 1 0 1 7.0 1 0 0 8.0 1 0 1 8.0 1 0 0 9.0 1 0 0 99.0 1 0 0 8.0 1 0 0 6.0 1 0 1 5.0 1 0 1 9.0 1 0 1 7.0 1 0 1 6.0 1 0 1 7.0 1 0 0 6.0 1 0 0 6.0 1 0 1 7.0 1 0 1 7.0 1 0 0 6.0 1 0 1 6.0 1 0 0 6.0 1 0 0 8.0 1 0 1 6.0 1 0 0 7.0 1 0 1 7.0 1 0 1 5.0 1 0 0 8.0 1 0 1 4.0 1 0 1 7.0 1 0 1 8.0 1 0 1 10.0 1 0 1 6.0 1 0 0 7.0 1 0 1 5.0 1 0 0 6.0 1 0 0 6.0 1 0 0 10.0 1 0 0 7.0 1 0 0 6.0 1
 
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)3.806688235785290.8766448235908944.342338120691132.01116086806508e-05
snoring1.393180661756700.3512782684784113.966031453614759.4183394305336e-05
sleep_time-0.5403326407563270.108879632513600-4.962660401051921.24795605160877e-06
sex-1.226537687171920.291721501925025-4.204481600012973.58609574284685e-05


Summary of Bias-Reduced Logistic Regression
Deviance299.232873990727
Penalized deviance286.213583359798
Residual Degrees of Freedom264
ROC Area0.780129928315412
Hosmer–Lemeshow test
Chi-square17.7831143534614
Degrees of Freedom8
P(>Chi)0.0229126034525216


Fit of Logistic Regression
IndexActualFittedError
110.4707909270704240.529209072929576
210.5649468321382640.435053167861736
310.3914624415917780.608537558408222
410.3293038377188780.670696162281122
510.5781775815266620.421822418473338
610.7449319190723060.255068080927694
710.6667516185335980.333248381466402
810.4174859220762000.5825140779238
910.690315780972120.309684219027879
1010.690315780972120.309684219027879
1110.3660417771932570.633958222806743
1210.4707909270704240.529209072929576
1310.6042877456672610.395712254332739
1410.3174818125239030.682518187476097
1510.3535961891001470.646403810899853
1610.2725939155906550.727406084409345
1710.2416597368455270.758340263154473
1810.3058906334383320.694109366561668
1910.4174859220762000.5825140779238
2010.2834385965008260.716561403499174
2110.8260750455325680.173924954467432
2210.8260750455325680.173924954467432
2310.6298165041089660.370183495891034
2410.4842711392643050.515728860735695
2510.4044069899095730.595593010090427
2610.4842711392643050.515728860735695
2710.4306819728913210.569318027108679
2810.4174859220762000.5825140779238
2910.5912970496654750.408702950334525
3010.4573531881106690.542646811889331
3110.3660417771932570.633958222806743
3210.3174818125239030.682518187476097
3310.5516229174163670.448377082583633
3410.2834385965008260.716561403499174
3510.3413459144528410.658654085547159
3610.6667516185335980.333248381466402
3710.7449319190723060.255068080927694
3810.3174818125239030.682518187476097
3910.2516995929394110.748300407060589
4010.900828201762070.0991717982379305
4110.2151736547797050.784826345220295
4210.144264062714570.85573593728543
4310.1581244356840510.841875564315949
4410.2151736547797050.784826345220295
4510.1890619583404690.810938041659531
4610.0810090331726550.918990966827345
4700.51128066526522-0.51128066526522
4800.17138152665176-0.17138152665176
4900.131428950631807-0.131428950631807
5000.51128066526522-0.51128066526522
5100.17138152665176-0.17138152665176
5200.0171288552308319-0.0171288552308319
5300.90082820176207-0.90082820176207
5400.262012444339769-0.262012444339769
5500.378668801730568-0.378668801730568
5600.642323462301025-0.642323462301025
5700.131428950631807-0.131428950631807
5800.131428950631807-0.131428950631807
5900.17138152665176-0.17138152665176
6000.081009033172655-0.081009033172655
6100.131428950631807-0.131428950631807
6200.262012444339769-0.262012444339769
6300.378668801730568-0.378668801730568
6400.378668801730568-0.378668801730568
6500.131428950631807-0.131428950631807
6600.51128066526522-0.51128066526522
6700.378668801730568-0.378668801730568
6800.262012444339769-0.262012444339769
6900.378668801730568-0.378668801730568
7000.755062157782796-0.755062157782796
7100.378668801730568-0.378668801730568
7200.755062157782796-0.755062157782796
7300.262012444339769-0.262012444339769
7400.51128066526522-0.51128066526522
7500.262012444339769-0.262012444339769
7600.51128066526522-0.51128066526522
7700.262012444339769-0.262012444339769
7800.262012444339769-0.262012444339769
7900.378668801730568-0.378668801730568
8000.262012444339769-0.262012444339769
8100.51128066526522-0.51128066526522
8200.378668801730568-0.378668801730568
8300.378668801730568-0.378668801730568
8400.378668801730568-0.378668801730568
8500.51128066526522-0.51128066526522
8600.17138152665176-0.17138152665176
8700.433549171071506-0.433549171071506
8800.206189299756933-0.206189299756933
8900.131428950631807-0.131428950631807
9000.131428950631807-0.131428950631807
9100.378668801730568-0.378668801730568
9202.27081447211273e-23-2.27081447211273e-23
9300.17138152665176-0.17138152665176
9400.17138152665176-0.17138152665176
9500.308377052776555-0.308377052776555
9600.107532185927388-0.107532185927388
9700.51128066526522-0.51128066526522
9800.131428950631807-0.131428950631807
9909.14602379745636e-23-9.14602379745636e-23
10000.378668801730568-0.378668801730568
10100.378668801730568-0.378668801730568
10200.262012444339769-0.262012444339769
10300.51128066526522-0.51128066526522
10402.27081447211273e-23-2.27081447211273e-23
10500.378668801730568-0.378668801730568
10600.378668801730568-0.378668801730568
10700.131428950631807-0.131428950631807
10800.262012444339769-0.262012444339769
10900.0488439199230939-0.0488439199230939
11000.081009033172655-0.081009033172655
11100.378668801730568-0.378668801730568
11200.710533873848487-0.710533873848487
11300.51128066526522-0.51128066526522
11400.262012444339769-0.262012444339769
11500.378668801730568-0.378668801730568
11600.081009033172655-0.081009033172655
11700.107532185927388-0.107532185927388
11800.378668801730568-0.378668801730568
11900.262012444339769-0.262012444339769
12000.378668801730568-0.378668801730568
12100.262012444339769-0.262012444339769
12200.262012444339769-0.262012444339769
12300.0488439199230939-0.0488439199230939
12400.642323462301025-0.642323462301025
12500.206189299756933-0.206189299756933
12600.378668801730568-0.378668801730568
12700.378668801730568-0.378668801730568
12800.378668801730568-0.378668801730568
12900.262012444339769-0.262012444339769
13010.4399750322642890.560024967735711
13110.6750982409915620.324901759008438
13210.6750982409915620.324901759008438
13310.5341889314549870.465811068545013
13410.6868360215594020.313163978440598
13510.8837194357447440.116280564255256
13610.5609543139168990.439045686083101
13710.4135449242103610.586455075789639
13810.7206057723858510.279394227614149
13910.6631362887205480.336863711279452
14010.7716470402138770.228352959786123
14110.7810281494195930.218971850580407
14210.761986506201670.23801349379833
14310.9173114983673320.0826885016326676
14410.7901286855367350.209871314463265
14510.8074877037033390.192512296296661
14610.6132914695485620.386708530451438
14710.4802194302917870.519780569708213
14810.8659987006278280.134001299372172
14910.9041548489856420.0958451510143582
15010.8237312241811690.176268775818831
15110.6132914695485620.386708530451438
15210.4937177478109180.506282252189082
15310.8993690408034140.100630959196586
15410.6868360215594020.313163978440598
15510.7989483619814370.201051638018563
15610.8314400312890540.168559968710946
15710.7418363442865220.258163655713478
15810.6868360215594020.313163978440598
15910.6631362887205480.336863711279452
16010.7418363442865220.258163655713478
16110.6750982409915620.324901759008438
16210.7901286855367350.209871314463265
16310.7520486044863670.247951395513633
16410.6750982409915620.324901759008438
16510.9041548489856420.0958451510143582
16610.6132914695485620.386708530451438
16710.8837194357447440.116280564255256
16810.6868360215594020.313163978440598
16910.761986506201670.23801349379833
17010.5072252302351060.492774769764894
17110.3024561032594490.697543896740551
17210.9526072058166110.0473927941833887
17310.6132914695485620.386708530451438
17410.9131195111160.0868804888839997
17510.547606038738910.45239396126109
17610.547606038738910.45239396126109
17710.6868360215594020.313163978440598
17810.6385867690440640.361413230955936
17910.8721459244338180.127854075566182
18010.466749929202380.53325007079762
18110.6385867690440640.361413230955936
18210.7206057723858510.279394227614149
18310.6260252232043220.373974776795678
18410.4802194302917870.519780569708213
18510.547606038738910.45239396126109
18610.9670406422775730.0329593577224271
18710.6750982409915620.324901759008438
18810.6132914695485620.386708530451438
18910.7095985595866310.290401440413369
19010.7313537255941140.268646274405886
19110.6260252232043220.373974776795678
19210.6132914695485620.386708530451438
19310.9501072510236480.0498927489763523
19410.8943721817078810.105627818292119
19510.6260252232043220.373974776795678
19610.9572542389620950.0427457610379050
19710.574214972277450.425785027722550
19810.6631362887205480.336863711279452
19910.6385867690440640.361413230955936
20010.4562258757949890.543774124205011
20110.5101453915809960.489854608419004
20210.5901986684918950.409801331508105
20310.7229521147284330.277047885271567
20410.2825167794416370.717483220558363
20510.4295683598619870.570431640138013
20610.2935968890908690.706403110909131
20710.2508448642578840.749155135742116
20800.0751142117827291-0.0751142117827291
20900.54760603873891-0.54760603873891
21000.34032521331786-0.34032521331786
21100.781028149419593-0.781028149419593
21200.54760603873891-0.54760603873891
21300.413544924210361-0.413544924210361
21400.46965915972222-0.46965915972222
21500.413544924210361-0.413544924210361
21600.781028149419593-0.781028149419593
21700.675098240991562-0.675098240991562
21800.291179468847894-0.291179468847894
21900.231088000282078-0.231088000282078
22000.675098240991562-0.675098240991562
22100.34032521331786-0.34032521331786
22200.231088000282078-0.231088000282078
22300.34032521331786-0.34032521331786
22400.34032521331786-0.34032521331786
22500.148994325224077-0.148994325224077
22600.231088000282078-0.231088000282078
22700.46965915972222-0.46965915972222
22800.231088000282078-0.231088000282078
22900.231088000282078-0.231088000282078
23000.675098240991562-0.675098240991562
23100.781028149419593-0.781028149419593
23200.54760603873891-0.54760603873891
23300.148994325224077-0.148994325224077
23400.413544924210361-0.413544924210361
23500.0925538810797928-0.0925538810797928
23607.74212542485812e-23-7.74212542485812e-23
23700.148994325224077-0.148994325224077
23800.34032521331786-0.34032521331786
23900.781028149419593-0.781028149419593
24000.291179468847894-0.291179468847894
24100.54760603873891-0.54760603873891
24200.675098240991562-0.675098240991562
24300.54760603873891-0.54760603873891
24400.34032521331786-0.34032521331786
24500.34032521331786-0.34032521331786
24600.54760603873891-0.54760603873891
24700.54760603873891-0.54760603873891
24800.34032521331786-0.34032521331786
24900.675098240991562-0.675098240991562
25000.34032521331786-0.34032521331786
25100.148994325224077-0.148994325224077
25200.675098240991562-0.675098240991562
25300.231088000282078-0.231088000282078
25400.54760603873891-0.54760603873891
25500.781028149419593-0.781028149419593
25600.148994325224077-0.148994325224077
25700.859603496793332-0.859603496793332
25800.54760603873891-0.54760603873891
25900.413544924210361-0.413544924210361
26000.193099432567248-0.193099432567248
26100.675098240991562-0.675098240991562
26200.231088000282078-0.231088000282078
26300.781028149419593-0.781028149419593
26400.34032521331786-0.34032521331786
26500.34032521331786-0.34032521331786
26600.0560845692686134-0.0560845692686134
26700.231088000282078-0.231088000282078
26800.34032521331786-0.34032521331786


Type I & II errors for various threshold values
ThresholdType IType II
0.0100.972222222222222
0.0200.965277777777778
0.0300.965277777777778
0.0400.965277777777778
0.0500.951388888888889
0.0600.944444444444444
0.0700.944444444444444
0.0800.9375
0.090.008064516129032260.916666666666667
0.10.008064516129032260.909722222222222
0.110.008064516129032260.895833333333333
0.120.008064516129032260.895833333333333
0.130.008064516129032260.895833333333333
0.140.008064516129032260.833333333333333
0.150.01612903225806450.798611111111111
0.160.02419354838709680.798611111111111
0.170.02419354838709680.798611111111111
0.180.02419354838709680.756944444444444
0.190.0322580645161290.756944444444444
0.20.0322580645161290.75
0.210.0322580645161290.736111111111111
0.220.04838709677419350.736111111111111
0.230.04838709677419350.736111111111111
0.240.04838709677419350.680555555555556
0.250.05645161290322580.680555555555556
0.260.07258064516129030.680555555555556
0.270.07258064516129030.576388888888889
0.280.08064516129032260.576388888888889
0.290.1048387096774190.576388888888889
0.30.1129032258064520.5625
0.310.1290322580645160.555555555555556
0.320.1532258064516130.555555555555556
0.330.1612903225806450.555555555555556
0.340.1612903225806450.555555555555556
0.350.1693548387096770.472222222222222
0.360.1774193548387100.472222222222222
0.370.1935483870967740.472222222222222
0.380.1935483870967740.319444444444444
0.390.1935483870967740.319444444444444
0.40.2016129032258060.319444444444444
0.410.2096774193548390.319444444444444
0.420.2419354838709680.291666666666667
0.430.250.291666666666667
0.440.2661290322580650.284722222222222
0.450.2661290322580650.284722222222222
0.460.2822580645161290.284722222222222
0.470.2903225806451610.270833333333333
0.480.3064516129032260.270833333333333
0.490.3387096774193550.270833333333333
0.50.3467741935483870.270833333333333
0.510.3548387096774190.270833333333333
0.520.3629032258064520.201388888888889
0.530.3629032258064520.201388888888889
0.540.3709677419354840.201388888888889
0.550.3951612903225810.138888888888889
0.560.4032258064516130.138888888888889
0.570.4193548387096770.138888888888889
0.580.4354838709677420.138888888888889
0.590.4354838709677420.138888888888889
0.60.4516129032258060.138888888888889
0.610.4596774193548390.138888888888889
0.620.5080645161290320.138888888888889
0.630.5403225806451610.138888888888889
0.640.5645161290322580.138888888888889
0.650.5645161290322580.125
0.660.5645161290322580.125
0.670.6048387096774190.125
0.680.645161290322580.0763888888888889
0.690.6854838709677420.0763888888888889
0.70.7016129032258060.0763888888888889
0.710.7096774193548390.0763888888888889
0.720.7096774193548390.0694444444444444
0.730.7338709677419350.0694444444444444
0.740.7419354838709680.0694444444444444
0.750.7741935483870970.0694444444444444
0.760.7822580645161290.0555555555555556
0.770.7983870967741940.0555555555555556
0.780.8064516129032260.0555555555555556
0.790.8145161290322580.0138888888888889
0.80.8387096774193550.0138888888888889
0.810.8467741935483870.0138888888888889
0.820.8467741935483870.0138888888888889
0.830.8709677419354840.0138888888888889
0.840.8790322580645160.0138888888888889
0.850.8790322580645160.0138888888888889
0.860.8790322580645160.00694444444444444
0.870.8870967741935480.00694444444444444
0.880.895161290322580.00694444444444444
0.890.9112903225806450.00694444444444444
0.90.927419354838710.00694444444444444
0.910.9516129032258060
0.920.9677419354838710
0.930.9677419354838710
0.940.9677419354838710
0.950.9677419354838710
0.960.9919354838709680
0.9710
0.9810
0.9910
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t12016836451ox49wz8atxiqti/158ww1201683568.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t12016836451ox49wz8atxiqti/158ww1201683568.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t12016836451ox49wz8atxiqti/28l6n1201683568.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/30/t12016836451ox49wz8atxiqti/28l6n1201683568.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
hm <- hosmerlem(y[1,],r$fitted.values)
hm
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.row.start(a)
a<-table.element(a,'Hosmer–Lemeshow test',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Chi-square',1,TRUE)
a<-table.element(a,hm[1])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Degrees of Freedom',1,TRUE)
a<-table.element(a,hm[2])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'P(>Chi)',1,TRUE)
a<-table.element(a,hm[3])
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