Creating a logistic regression model to predict claims

Hi All,

Hope you are doing well!...I am trying to build a logistic regression model to predict the probability that an order would turn into a claim...Following is the data that I am trying to build the logistic regression ...Can you please help me with the code and the output understanding of running the logistic regression from R...

tibble::tribble(
~Timegap, ~product.type, ~Order.Value.Bucket, ~Count.of.Tickets, ~Output,
3.1321147800918, 0, 8, 2, 1,
7.18477832175995, 0, 8, 3, 1,
3.91707519675401, 0, 8, 3, 1,
16.5962684027763, 1, 8, 2, 1,
18.660517245371, 0, 8, 4, 1,
7.37293376157322, 0, 8, 2, 1,
2.47612936342193, 0, 8, 3, 1,
8.54674024305859, 0, 8, 3, 1,
4.84713862268109, 1, 8, 3, 1,
3.42526678240392, 0, 8, 2, 1,
27.7513013541684, 1, 8, 2, 1,
5.25379730323766, 0, 8, 4, 1,
4.11020296296192, 0, 8, 2, 1,
3.80668290508765, 0, 8, 2, 1,
3.81196921296214, 0, 8, 2, 1,
8.0734229166701, 1, 8, 3, 1,
12.4881135763862, 0, 8, 3, 1,
17.0211580671312, 0, 8, 3, 1,
4.03162353009247, 1, 8, 3, 1,
6.06064715277898, 0, 8, 4, 1,
8.60165594907448, 0, 8, 4, 1,
11.5608290856471, 0, 8, 3, 1,
3.78582653935155, 0, 8, 3, 1,
7.15545258102065, 0, 8, 3, 1,
18.5399899652766, 0, 8, 2, 1,
2.91038414351351, 0, 8, 3, 1,
2.16849518518575, 0, 8, 3, 1,
16.1982369560137, 0, 8, 3, 1,
10.06054903935, 0, 8, 3, 1,
2.91019062499981, 0, 8, 2, 1,
2.91645261574013, 0, 8, 2, 1,
2.81581592592556, 1, 8, 2, 1,
4.16526137731125, 0, 8, 3, 1,
4.26860925925575, 0, 8, 4, 1,
3.4117636574083, 0, 8, 2, 1,
3.71318453703134, 1, 8, 2, 1,
21.3305061689825, 0, 8, 3, 1,
5.85386650462897, 1, 8, 2, 1,
2.1209250000029, 0, 8, 2, 1,
5.15720150463312, 0, 8, 2, 1,
9.51952947917016, 0, 8, 3, 1,
5.60093394675641, 0, 8, 2, 1,
6.09672531249817, 0, 8, 3, 1,
3.80008634259138, 0, 8, 2, 1,
5.6847513541652, 0, 8, 2, 1,
11.514642245369, 0, 8, 3, 1,
9.24674143518496, 0, 8, 4, 1,
4.2035232638882, 0, 8, 3, 1,
9.61730806712876, 0, 8, 2, 1,
7.29592936342669, 1, 8, 2, 1,
6.45631211805448, 1, 8, 2, 1,
13.6470644675937, 0, 8, 3, 1,
54.4268431365708, 0, 8, 1, 1,
11.611876388888, 1, 8, 2, 1,
4.09662939814734, 0, 8, 2, 1,
21.140372106478, 1, 8, 3, 1,
1.16839760416769, 1, 8, 3, 1,
3.97815598379384, 0, 8, 1, 1,
30.6182105671323, 0, 8, 3, 1,
3.02661906249705, 1, 8, 2, 1,
33.2758660069449, 0, 8, 3, 1,
9.51465243055281, 0, 8, 2, 1,
9.4028476504609, 0, 8, 2, 1,
3.16466952546034, 1, 8, 3, 1,
3.00413912037038, 0, 8, 2, 1,
50.5973099189796, 0, 8, 3, 1,
3.16950462962996, 0, 8, 2, 1,
3.45635424768261, 1, 8, 3, 1,
10.3105129282412, 1, 8, 3, 1,
4.27971836805227, 0, 8, 3, 1,
8.44659927083558, 1, 8, 4, 1,
19.5474165162013, 0, 8, 2, 1,
2.90748815971892, 0, 8, 3, 1,
21.996297303238, 1, 8, 1, 1,
52.451494131943, 0, 8, 2, 1,
17.470820486109, 0, 8, 3, 1,
5.56329447916505, 0, 8, 2, 1,
7.61736064814613, 0, 8, 2, 1,
2.30564618055359, 1, 8, 2, 1,
4.19838498842728, 0, 8, 3, 1,
2.39313822917029, 0, 8, 2, 1,
6.35313318287081, 1, 8, 1, 1,
23.3444256944422, 0, 8, 2, 1,
11.2521563657428, 0, 8, 2, 1,
43.8993541319433, 0, 8, 2, 1,
20.6205276620385, 0, 8, 4, 1,
12.6185133101826, 0, 8, 4, 1,
7.36872708333249, 0, 8, 2, 1,
2.27645671296341, 1, 8, 3, 1,
3.56805609953881, 1, 8, 3, 0,
1.37852060185105, 1, 8, 3, 0,
6.60208700231306, 1, 8, 2, 0,
6.61825555555697, 0, 8, 3, 0,
14.8625558217609, 1, 8, 3, 0,
20.0080062499983, 1, 8, 5, 0,
4.13115011573973, 1, 8, 2, 0,
10.6197640393511, 0, 8, 3, 0,
96.6015397337978, 0, 8, 3, 0,
3.66477924767969, 1, 13, 4, 0,
6.02431701388559, 0, 13, 6, 0,
11.5472783217556, 0, 13, 1, 0,
21.2596300578734, 0, 13, 1, 0,
38.0183899652766, 0, 13, 4, 0,
3.07905856481375, 0, 13, 4, 0,
4.69381651620643, 1, 13, 2, 0,
18.9396611921329, 0, 13, 3, 0,
3.91402604166797, 0, 13, 3, 0,
2.12380540509184, 1, 13, 6, 0,
15.9588731828699, 0, 13, 3, 0,
11.7793083333381, 0, 13, 3, 0,
5.19271346064488, 0, 13, 2, 0,
15.886746493059, 1, 13, 7, 0,
5.97561658565246, 0, 13, 6, 0,
12.8671155092597, 0, 13, 2, 0,
2.19963596064918, 0, 13, 3, 0,
11.0608620717539, 0, 13, 2, 0,
6.68887936342799, 0, 13, 2, 0,
2.83130347221595, 0, 13, 7, 0,
18.798286840276, 0, 13, 8, 0,
18.8147839467565, 1, 13, 10, 0,
12.2724806365732, 0, 13, 2, 0,
7.94156203704188, 1, 13, 5, 0,
10.912466400463, 0, 13, 7, 0,
6.92213290509244, 0, 13, 2, 0,
2.07795277777768, 0, 13, 3, 0,
2.11652530092397, 0, 13, 4, 0,
9.52225960648502, 1, 13, 5, 0,
34.1085448263912, 0, 13, 2, 0,
33.9588062847179, 0, 13, 2, 0,
7.64092422453541, 0, 13, 3, 0,
14.0577993402767, 0, 13, 3, 0,
37.2448001504599, 0, 13, 4, 0,
4.87258109953837, 0, 13, 6, 0,
4.80431655092252, 0, 13, 7, 0,
7.2817032060193, 0, 13, 2, 0,
7.93998773148633, 0, 13, 4, 0,
16.0607628124999, 0, 13, 2, 0,
5.88749143518362, 0, 13, 5, 0,
6.57944259259239, 0, 13, 9, 0,
11.389568368053, 0, 13, 5, 0,
15.1973455671323, 0, 13, 5, 0,
68.7998018518556, 0, 13, 1, 0,
21.7145893055567, 0, 13, 2, 0,
10.9593918287064, 0, 13, 2, 0,
27.8669247685175, 0, 13, 2, 0,
30.4883194097201, 0, 13, 2, 0,
2.3063722222214, 0, 13, 7, 0,
13.223773877311, 1, 13, 2, 0,
16.68766891204, 0, 13, 2, 0,
23.3603651967569, 0, 13, 5, 0,
6.21814185185212, 0, 13, 1, 0,
13.192762152772, 0, 13, 2, 0,
11.3116745717562, 0, 13, 4, 0,
42.1290690162059, 0, 13, 2, 0,
19.8270667361066, 0, 13, 2, 0,
123.046333796301, 0, 13, 1, 0,
12.0665660532468, 0, 13, 6, 0,
22.8971713657447, 0, 13, 5, 0,
55.4618570949096, 0, 13, 6, 0,
31.9400756944378, 0, 13, 4, 0,
5.96026604167128, 0, 13, 7, 0,
148.080977777776, 0, 13, 6, 0,
9.08541207175585, 0, 13, 4, 0,
2.5960972916655, 0, 13, 3, 0,
12.6709663541697, 0, 13, 3, 0,
20.055263495371, 0, 13, 4, 0,
128.516146956019, 0, 13, 2, 0,
18.9640832986042, 0, 13, 2, 0,
10.2589767824102, 0, 13, 5, 0,
12.9545122338022, 0, 13, 4, 0,
18.9445546296265, 0, 13, 5, 0,
33.5338437152823, 0, 13, 3, 0,
35.5765594907425, 0, 13, 2, 0,
4.09336373842234, 0, 13, 6, 0,
14.1063916666681, 0, 13, 1, 0,
24.4354871527757, 0, 13, 2, 0,
3.20368336805404, 1, 13, 2, 0,
4.79122179398109, 1, 13, 10, 0,
15.5617887268527, 0, 13, 4, 0,
12.658705243055, 0, 13, 1, 0,
7.06237430555484, 0, 13, 7, 0,
2.67319173611031, 0, 13, 5, 0,
11.9015363773215, 0, 13, 5, 0,
3.72240042823978, 0, 13, 4, 0,
24.9967852546324, 0, 13, 2, 0,
5.01274193287099, 0, 13, 2, 0,
2.84018564814323, 0, 13, 2, 0,
33.9750065509288, 0, 13, 3, 0,
9.82819560185453, 0, 13, 3, 0,
6.31537877314986, 0, 13, 1, 0,
11.8115219907413, 0, 13, 3, 0,
6.79581354167021, 0, 13, 2, 0,
8.45368839120056, 0, 13, 5, 0,
4.28128893518442, 0, 13, 3, 0,
100.447039618055, 0, 13, 5, 0,
5.99262565972458, 0, 13, 2, 0,
5.48237291666737, 0, 13, 5, 0,
20.5631030902732, 0, 13, 3, 0,
15.6124427777831, 0, 13, 5, 0,
30.183479942134, 0, 13, 2, 0,
10.9275295833359, 0, 13, 8, 0,
18.2170680555573, 0, 13, 3, 0,
2.8914482986147, 0, 13, 2, 0,
62.0906981828739, 0, 13, 6, 0,
2.93805671296286, 0, 13, 4, 0,
14.1331233333331, 0, 13, 3, 0,
7.4551392013891, 0, 13, 2, 0,
19.595512384265, 0, 13, 4, 0,
4.73215064814576, 1, 13, 2, 0,
7.00711377314292, 0, 13, 9, 0,
24.2289543287043, 0, 13, 4, 0,
24.0003293287009, 0, 13, 3, 0,
28.7891835995324, 0, 13, 2, 0,
35.8076254166663, 0, 13, 2, 0,
25.0177481944411, 0, 13, 2, 0,
18.0757848379653, 0, 13, 2, 0,
22.334406412032, 0, 13, 1, 0,
19.3302328703649, 0, 13, 3, 0,
3.21111625000049, 0, 13, 5, 0,
13.1312091435175, 0, 13, 3, 0,
17.5538198379654, 0, 13, 3, 0,
3.57730031249957, 0, 13, 5, 0,
3.83092226852023, 0, 13, 7, 0,
4.22261901620368, 0, 13, 3, 0,
19.330403935186, 0, 13, 3, 0,
79.9498209837984, 0, 13, 5, 0,
11.8611162731468, 0, 13, 4, 0,
8.18670509258664, 0, 13, 2, 0,
14.6465991087971, 0, 13, 4, 0,
32.2221650810243, 0, 13, 7, 0,
11.8818939467601, 0, 13, 2, 0,
17.9546712962983, 0, 13, 3, 0,
25.947184293982, 0, 13, 3, 0,
27.7449233333318, 0, 13, 5, 0,
24.9393442939763, 0, 13, 2, 0,
6.76366967592912, 0, 13, 2, 0,
21.5510959953681, 0, 13, 3, 0,
21.0825966782431, 1, 13, 1, 0,
16.6619318634257, 0, 13, 2, 0,
18.6485036689774, 0, 13, 3, 0,
28.6146330208285, 0, 13, 4, 0,
2.95710894675722, 1, 13, 2, 0,
5.8686787037077, 1, 13, 4, 0,
3.55554861110431, 0, 13, 2, 0,
44.5560280902791, 0, 13, 2, 0,
21.2314034722222, 0, 13, 4, 0,
39.4656542824087, 0, 13, 2, 0,
54.140693564812, 0, 13, 3, 0,
14.5982726388829, 0, 13, 2, 0,
29.0886343402744, 0, 13, 2, 0,
50.111173344907, 0, 13, 2, 0,
18.704708287034, 0, 13, 3, 0,
15.6470846527809, 0, 13, 4, 0,
7.13970026619791, 0, 13, 2, 0,
7.13970547453209, 0, 13, 2, 0,
20.4690454513911, 0, 13, 2, 0,
34.1924359143522, 0, 13, 3, 0,
33.0076539699076, 0, 13, 3, 0,
72.505091666666, 1, 13, 2, 0,
140.6066474537, 0, 13, 1, 0,
3.55243035879539, 0, 13, 2, 0,
20.8605495370357, 0, 13, 3, 0,
28.6923449074093, 0, 13, 2, 0,
10.4598485300958, 1, 13, 6, 0,
5.75702499999898, 0, 13, 2, 0,
98.1966778935239, 0, 13, 1, 0,
27.1096870833353, 0, 13, 2, 0,
34.310459340275, 0, 13, 4, 0,
34.2974690509291, 0, 13, 4, 0,
15.4215263194419, 0, 13, 2, 0,
22.4300420138898, 0, 13, 4, 0,
49.9768775810226, 0, 13, 3, 0,
5.23929831018177, 0, 13, 4, 0,
7.89430026620539, 1, 13, 6, 0,
19.1626514236123, 0, 13, 2, 0,
18.0066818634295, 0, 13, 1, 0,
4.791155358791, 0, 13, 2, 0,
13.7035392013931, 0, 13, 2, 0,
13.4587941319405, 0, 13, 6, 0,
7.96728862269083, 0, 13, 4, 0,
6.68750644676038, 0, 13, 2, 0,
2.14067962962872, 0, 13, 2, 0,
44.6887881597213, 0, 13, 3, 0,
11.0567610300932, 0, 13, 3, 0,
30.3895614930516, 0, 13, 2, 0,
28.6796192476831, 0, 13, 3, 0,
12.0941394328693, 0, 13, 3, 0,
26.4784000810178, 0, 13, 5, 0,
16.6852503472182, 0, 13, 3, 0,
26.2621458680587, 0, 13, 3, 0,
10.7111824074091, 0, 13, 3, 0,
4.90278310185386, 0, 13, 4, 0,
11.0126268055537, 0, 13, 6, 0,
10.1735182870398, 0, 13, 1, 0,
39.6693727546299, 0, 13, 3, 0,
33.9812423611074, 0, 13, 2, 0,
11.2265046759276, 0, 13, 5, 0,
24.0961942939757, 0, 13, 2, 0,
46.768130833334, 0, 13, 5, 0,
15.5560326388877, 0, 13, 2, 0,
26.4153050925888, 0, 13, 3, 0,
8.58191856481426, 0, 13, 2, 0,
32.991972916665, 0, 13, 3, 0,
4.68893050926272, 0, 13, 3, 0,
16.6287072569394, 0, 13, 2, 0,
12.6071947106466, 0, 13, 6, 0,
3.75696774305106, 0, 13, 4, 0,
16.8974765046296, 0, 13, 5, 0,
99.9674753935178, 0, 13, 4, 0,
44.8198559375014, 0, 13, 4, 0,
8.9498903935164, 0, 13, 3, 0,
17.2965283564772, 1, 13, 2, 0,
16.1276547800953, 0, 13, 2, 0,
29.3888515046274, 1, 13, 2, 0,
12.106067175926, 0, 13, 5, 0,
4.20901855323609, 0, 13, 2, 0,
6.41316612268565, 0, 13, 2, 0,
26.0056175115751, 0, 13, 2, 0,
22.0886926736057, 0, 13, 3, 0,
3.20901157407206, 0, 13, 6, 0,
2.08290609953838, 1, 13, 5, 0,
4.49930412037065, 0, 13, 2, 0,
5.99518927083409, 0, 13, 4, 0,
48.045727777775, 0, 13, 4, 0,
13.1027542129668, 0, 13, 4, 0,
5.58202515046287, 0, 13, 2, 0,
9.09233915508958, 0, 13, 4, 0,
17.1166302893544, 0, 13, 3, 0,
4.80075679398578, 0, 13, 6, 0,
2.12154042824113, 0, 13, 3, 0,
16.8881533564781, 0, 13, 3, 0,
24.7220104976877, 0, 13, 2, 0,
2.94650894675578, 1, 13, 3, 0,
8.66674552083714, 0, 13, 5, 0,
21.9561975000033, 0, 13, 5, 0,
10.9628058217641, 0, 13, 3, 0
)

What have you tried so far? what is your specific problem?, we are more inclined towards helping you with specific coding problems rather than doing your work for you.

Could you please turn this into a self-contained REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

Second @andresrcs's request that you give it a whirl, and then we can help you if you get stuck!

Here are a few tutorials you might look at to help you get started (you definitely don't need to read all of them, just giving you options for what suits your needs most)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.