# predict.clogitboost: Predicting after fitting a boosting conditional logit model In clogitboost: Boosting Conditional Logit Model

## Description

`predict` methods for the `clogitboost` objects, which produce marginal predictions of the covariate effects.

## Usage

 ```1 2``` ```## S3 method for class 'clogitboost' predict(object, x, strata, ...) ```

## Arguments

 `object` output object from the `clogitboost` function. `x` new matrix or data frame with each column being a covariate. `strata` new vector of group memberships, i.e., items in the same group have the same value. `...` not currently used.

## Value

The method `predict` returns the following list of values:

 `prob` probability of the outcome equal to 1. `utility` predicted utility. `prediction` 0-1 prediction of the outcome variable.

## Author(s)

Haolun Shi shl2003@connect.hku.hk

Guosheng Yin gyin@hku.hk

`clogitboost`

## Examples

 ```1 2 3 4 5 6 7``` ```data(travel) train <- 1:504 y <- travel\$MODE[train] x <- travel[train, 3:6] strata <- travel\$Group[train] fit <- clogitboost(y = y, x = x, strata = strata, iter = 10, rho = 0.05) predict(fit, x = travel[-train, 3:6], strata = travel\$Group[-train]) ```

### Example output

```\$prob
[1] 0.103380915 0.129816799 0.157400339 0.609401948 0.010503567 0.008162615
[7] 0.933347060 0.047986759 0.136851853 0.108892605 0.131523838 0.622731705
[13] 0.014465063 0.890131259 0.015989365 0.079414313 0.132062130 0.115128578
[19] 0.153951387 0.598857905 0.128627564 0.115584160 0.154560597 0.601227680
[25] 0.021018356 0.023781921 0.891327241 0.063872482 0.007899218 0.007956108
[31] 0.955884099 0.028260575 0.138639546 0.118147987 0.145546929 0.597665538
[37] 0.081118073 0.092075590 0.094064682 0.732741655 0.084674619 0.081030304
[43] 0.094862983 0.739432094 0.021551687 0.016049884 0.899705909 0.062692521
[49] 0.016686343 0.017108223 0.897217135 0.068988299 0.123716283 0.130146366
[55] 0.114895412 0.631241940 0.014355510 0.929700689 0.012532006 0.043411795
[61] 0.028275837 0.881478255 0.019670816 0.070575092 0.024408508 0.875458823
[67] 0.023931046 0.076201623 0.006757070 0.955116976 0.007022390 0.031103564
[73] 0.013343193 0.926336498 0.015299410 0.045020899 0.017499687 0.890450852
[79] 0.028913773 0.063135687 0.009650044 0.942617023 0.010073983 0.037658950
[85] 0.006736074 0.955490705 0.007037018 0.030736204 0.011372195 0.922731736
[91] 0.012544555 0.053351514 0.912561920 0.012760255 0.015042673 0.059635152
[97] 0.894918737 0.016816645 0.024647102 0.063617516 0.921622082 0.011139086
[103] 0.014996832 0.052242000 0.930893282 0.007804625 0.008493708 0.052808384
[109] 0.932652517 0.010943469 0.013759646 0.042644368 0.907982724 0.013884471
[115] 0.012496941 0.065635865 0.885491845 0.018936224 0.016802169 0.078769763
[121] 0.929311021 0.013422456 0.010757014 0.046509509 0.874417018 0.021149559
[127] 0.023582232 0.080851192 0.917165019 0.011542908 0.012371359 0.058920714
[133] 0.875653130 0.013704775 0.017009335 0.093632760 0.877410983 0.022563263
[139] 0.021494670 0.078531084 0.909342741 0.015951639 0.017730228 0.056975392
[145] 0.119926343 0.166620018 0.183023155 0.530430483 0.128712504 0.143443104
[151] 0.154300966 0.573543427 0.134816740 0.112254443 0.129217359 0.623711457
[157] 0.138951443 0.170457510 0.183745826 0.506845221 0.145322951 0.123551599
[163] 0.148093126 0.583032323 0.110617515 0.120364886 0.129194877 0.639822722
[169] 0.154551728 0.161525155 0.201782378 0.482140738 0.129998885 0.133896567
[175] 0.146266959 0.589837588 0.107743964 0.170471526 0.205716957 0.516067553
[181] 0.016708352 0.015471072 0.909028614 0.058791962 0.012412934 0.010408470
[187] 0.940886865 0.036291731 0.015055815 0.016420414 0.903243620 0.065280151
[193] 0.132408049 0.118781744 0.134295455 0.614514752 0.029026334 0.025101608
[199] 0.870029741 0.075842317 0.016920673 0.015073962 0.899032854 0.068972512
[205] 0.012741814 0.010544575 0.934579065 0.042134547 0.919000715 0.014356836
[211] 0.013786828 0.052855621 0.913204098 0.011132097 0.012494072 0.063169733
[217] 0.131796648 0.109832688 0.135077789 0.623292875 0.111215496 0.108910545
[223] 0.126934416 0.652939543 0.017671943 0.883839223 0.015076217 0.083412616
[229] 0.022981599 0.869025551 0.017062475 0.090930375 0.011778799 0.921096763
[235] 0.012602250 0.054522189 0.013070438 0.013401630 0.916627391 0.056900540
[241] 0.904552738 0.018317158 0.017813782 0.059316322 0.922758675 0.010955242
[247] 0.012808772 0.053477311 0.122350836 0.099246453 0.119872920 0.658529791
[253] 0.100861179 0.121758456 0.126997820 0.650382546 0.161875801 0.119109039
[259] 0.156979065 0.562036095 0.912176152 0.015098937 0.015945369 0.056779542
[265] 0.902338491 0.018354210 0.019471926 0.059835374 0.016077543 0.017317803
[271] 0.895266328 0.071338325 0.010574760 0.929827642 0.009294416 0.050303182
[277] 0.016319256 0.895000085 0.016797202 0.071883456 0.121738705 0.122319285
[283] 0.118957815 0.636984195 0.905254850 0.017618915 0.018534169 0.058592065
[289] 0.906073924 0.010848959 0.012176292 0.070900826 0.919106528 0.009996297
[295] 0.011145561 0.059751614 0.012602592 0.014331110 0.899773612 0.073292686
[301] 0.163416643 0.142803511 0.170330919 0.523448927 0.022679873 0.017625534
[307] 0.882594576 0.077100017 0.012653395 0.011043153 0.924780185 0.051523267
[313] 0.012257530 0.011417219 0.927664336 0.048660915 0.085963134 0.107931471
[319] 0.121723020 0.684382375 0.902442155 0.018141967 0.019084392 0.060331485
[325] 0.016130800 0.013523036 0.906190217 0.064155947 0.126178996 0.158424712
[331] 0.178668319 0.536727973 0.145024176 0.137513662 0.146137400 0.571324762

\$utility
505        506        507        508        509        510        511
-1.4063981 -1.1786943 -0.9860260  0.3676596 -1.1928095 -1.4449598  3.2942528
512        513        514        515        516        517        518
0.3264007 -0.9593091 -1.1878459 -0.9990199  0.5559077 -1.4065042  2.7131284
519        520        521        522        523        524        525
-1.3063167  0.2964381 -1.2668720 -1.4040949 -1.1135076  0.2448798 -1.2971727
526        527        528        529        530        531        532
-1.4040949 -1.1135076  0.2448798 -0.9856948 -0.8621654  2.7616206  0.1257976
533        534        535        536        537        538        539
-1.1401519 -1.1329759  3.6557209  0.1345520 -1.2162741 -1.3762135 -1.1676529
540        541        542        543        544        545        546
0.2448798 -1.2566870 -1.1299829 -1.1086101  0.9442004 -1.1227773 -1.1667700
547        548        549        550        551        552        553
-1.0091597  1.0442892 -0.8942539 -1.1890064  2.8373599  0.1735342 -0.9762139
554        555        556        557        558        559        560
-0.9512453  3.0084934  0.4431324 -1.2523203 -1.2016515 -1.3262889  0.3773780
561        562        563        564        565        566        567
-0.8764761  3.2942528 -1.0123241  0.2301212 -0.5906372  2.8489556 -0.9535087
568        569        570        571        572        573        574
0.3240325 -0.9942388  2.5855775 -1.0139940  0.1442122 -1.3335492  3.6176952
575        576        577        578        579        580        581
-1.2950351  0.1931838 -0.9805806  3.2596505 -0.8437728  0.2355398 -1.1219466
582        583        584        585        586        587        588
2.8075983 -0.6198116  0.1611565 -1.0474998  3.5341979 -1.0045061  0.3141084
589        590        591        592        593        594        595
-1.3623895  3.5923583 -1.3186822  0.1555745 -1.3980530  2.9981142 -1.2999376
596        597        598        599        600        601        602
0.1476781  3.1048752 -1.1650455 -1.0004897  0.3768645  2.8206751 -1.1536887
603        604        605        606        607        608        609
-0.7713985  0.1768310  3.2755039 -1.1401712 -0.8427924  0.4052554  3.3657723
610        611        612        613        614        615        616
-1.4156558 -1.3310466  0.4962976  3.3032160 -1.1420738 -0.9130766  0.2180785
617        618        619        620        621        622        623
2.9290336 -1.2514207 -1.3567078  0.3019306  2.6111115 -1.2339551 -1.3535237
624        625        626        627        628        629        630
0.1914974  3.1249428 -1.1125716 -1.3339427  0.1301561  2.8376865 -0.8842518
631        632        633        634        635        636        637
-0.7753773  0.4567395  2.9950213 -1.3801949 -1.3108821  0.2499266  2.7331733
638        639        640        641        642        643        644
-1.4240524 -1.2080344  0.4975836  2.7646208 -0.8960316 -0.9445497  0.3511398
645        646        647        648        649        650        651
2.9330001 -1.1101604 -1.0044510  0.1628975 -1.1525825 -0.8237443 -0.7298475
652        653        654        655        656        657        658
0.3342287 -1.3649099 -1.2565527 -1.1835861  0.1293425 -1.2143794 -1.3975277
659        660        661        662        663        664        665
-1.2567999  0.3173921 -0.9167031 -0.7123416 -0.6372742  0.3773780 -1.2089653
666        667        668        669        670        671        672
-1.3712650 -1.1900825  0.1803188 -1.4208840 -1.3364346 -1.2656405  0.3342287
673        674        675        676        677        678        679
-0.9895441 -0.9454120 -0.7228831  0.1481631 -1.3649099 -1.3353681 -1.2470023
680        681        682        683        684        685        686
0.1474115 -1.1801661 -0.7213555 -0.5334225  0.3863139 -1.0951990 -1.1721357
687        688        689        690        691        692        693
2.9012689  0.1628975 -0.9382731 -1.1143922  3.3898108  0.1345778 -1.3324043
694        695        696        697        698        699        700
-1.2456433  2.7618237  0.1345194 -1.0057915 -1.1143922 -0.9916376  0.5291530
701        702        703        704        705        706        707
-0.7105985 -0.8558701  2.6897254  0.2498544 -0.8679816 -0.9835489  3.1048018
708        709        710        711        712        713        714
0.5371903 -0.9216951 -1.1109726  3.3735122  0.2742839  2.9950213 -1.1640394
715        716        717        718        719        720        721
-1.2045519  0.1392984  3.0274975 -1.3796294 -1.2642077  0.3563633 -0.9978486
722        723        724        725        726        727        728
-1.1801506 -0.9732580  0.5559077 -1.1034535 -1.1243964 -0.9712527  0.6665613
729        730        731        732        733        734        735
-1.1978481  2.7144488 -1.3567078  0.3539732 -0.9942388  2.6384399 -1.2920511
736        737        738        739        740        741        742
0.3811614 -1.3408091  3.0184548 -1.2732350  0.1914974 -1.3380691 -1.3130459
743        744        745        746        747        748        749
2.9122788  0.1328826  2.9160535 -0.9835489 -1.0114146  0.1914974  3.0110077
750        751        752        753        754        755        756
-1.4225420 -1.2662298  0.1628975 -0.9785595 -1.1878459 -0.9990199  0.7045576
757        758        759        760        761        762        763
-1.0951990 -0.9069049 -0.8647742  0.7686166 -0.8250104 -1.1318004 -0.8557273
764        765        766        767        768        769        770
0.4197263  3.0489250 -1.0522838 -0.9977397  0.2722680  2.9048901 -0.9902406
771        772        773        774        775        776        777
-0.9311259  0.1914974 -1.3145655 -1.2402540  2.7051322  0.1754447 -1.1475984
778        779        780        781        782        783        784
3.3289309 -1.2766545  0.4119999 -1.2579987  2.7464793 -1.2291322  0.2247016
785        786        787        788        789        790        791
-0.9883066 -0.9835489 -1.0114146  0.6665613  2.8969539 -1.0422896 -0.9916466
792        793        794        795        796        797        798
0.1593367  3.0454224 -1.3796294 -1.2642077  0.4975836  3.1034744 -1.4177129
799        800        801        802        803        804        805
-1.3088863  0.3702686 -1.2547089 -1.1261786  3.0135318  0.5058495 -1.0057915
806        807        808        809        810        811        812
-1.1406249 -0.9643514  0.1583450 -0.9216951 -1.1738243  2.7396930  0.3019306
813        814        815        816        817        818        819
-1.0529681 -1.1890831  3.2386624  0.3511398 -1.0547032 -1.1257210  3.2718263
820        821        822        823        824        825        826
0.3240325 -1.1303978 -0.9028199 -0.7825682  0.9442004  2.8645872 -1.0422896
827        828        829        830        831        832        833
-0.9916466  0.1593367 -0.8246786 -1.0010145  3.2038402  0.5559077 -1.1303978
834        835        836        837        838        839        840
-0.9028199 -0.7825682  0.3173921 -1.2127124 -1.2658896 -1.2050656  0.1583450

\$prediction
[,1]
[1,]    0
[2,]    0
[3,]    0
[4,]    1
[5,]    0
[6,]    0
[7,]    1
[8,]    0
[9,]    0
[10,]    0
[11,]    0
[12,]    1
[13,]    0
[14,]    1
[15,]    0
[16,]    0
[17,]    0
[18,]    0
[19,]    0
[20,]    1
[21,]    0
[22,]    0
[23,]    0
[24,]    1
[25,]    0
[26,]    0
[27,]    1
[28,]    0
[29,]    0
[30,]    0
[31,]    1
[32,]    0
[33,]    0
[34,]    0
[35,]    0
[36,]    1
[37,]    0
[38,]    0
[39,]    0
[40,]    1
[41,]    0
[42,]    0
[43,]    0
[44,]    1
[45,]    0
[46,]    0
[47,]    1
[48,]    0
[49,]    0
[50,]    0
[51,]    1
[52,]    0
[53,]    0
[54,]    0
[55,]    0
[56,]    1
[57,]    0
[58,]    1
[59,]    0
[60,]    0
[61,]    0
[62,]    1
[63,]    0
[64,]    0
[65,]    0
[66,]    1
[67,]    0
[68,]    0
[69,]    0
[70,]    1
[71,]    0
[72,]    0
[73,]    0
[74,]    1
[75,]    0
[76,]    0
[77,]    0
[78,]    1
[79,]    0
[80,]    0
[81,]    0
[82,]    1
[83,]    0
[84,]    0
[85,]    0
[86,]    1
[87,]    0
[88,]    0
[89,]    0
[90,]    1
[91,]    0
[92,]    0
[93,]    1
[94,]    0
[95,]    0
[96,]    0
[97,]    1
[98,]    0
[99,]    0
[100,]    0
[101,]    1
[102,]    0
[103,]    0
[104,]    0
[105,]    1
[106,]    0
[107,]    0
[108,]    0
[109,]    1
[110,]    0
[111,]    0
[112,]    0
[113,]    1
[114,]    0
[115,]    0
[116,]    0
[117,]    1
[118,]    0
[119,]    0
[120,]    0
[121,]    1
[122,]    0
[123,]    0
[124,]    0
[125,]    1
[126,]    0
[127,]    0
[128,]    0
[129,]    1
[130,]    0
[131,]    0
[132,]    0
[133,]    1
[134,]    0
[135,]    0
[136,]    0
[137,]    1
[138,]    0
[139,]    0
[140,]    0
[141,]    1
[142,]    0
[143,]    0
[144,]    0
[145,]    0
[146,]    0
[147,]    0
[148,]    1
[149,]    0
[150,]    0
[151,]    0
[152,]    1
[153,]    0
[154,]    0
[155,]    0
[156,]    1
[157,]    0
[158,]    0
[159,]    0
[160,]    1
[161,]    0
[162,]    0
[163,]    0
[164,]    1
[165,]    0
[166,]    0
[167,]    0
[168,]    1
[169,]    0
[170,]    0
[171,]    0
[172,]    1
[173,]    0
[174,]    0
[175,]    0
[176,]    1
[177,]    0
[178,]    0
[179,]    0
[180,]    1
[181,]    0
[182,]    0
[183,]    1
[184,]    0
[185,]    0
[186,]    0
[187,]    1
[188,]    0
[189,]    0
[190,]    0
[191,]    1
[192,]    0
[193,]    0
[194,]    0
[195,]    0
[196,]    1
[197,]    0
[198,]    0
[199,]    1
[200,]    0
[201,]    0
[202,]    0
[203,]    1
[204,]    0
[205,]    0
[206,]    0
[207,]    1
[208,]    0
[209,]    1
[210,]    0
[211,]    0
[212,]    0
[213,]    1
[214,]    0
[215,]    0
[216,]    0
[217,]    0
[218,]    0
[219,]    0
[220,]    1
[221,]    0
[222,]    0
[223,]    0
[224,]    1
[225,]    0
[226,]    1
[227,]    0
[228,]    0
[229,]    0
[230,]    1
[231,]    0
[232,]    0
[233,]    0
[234,]    1
[235,]    0
[236,]    0
[237,]    0
[238,]    0
[239,]    1
[240,]    0
[241,]    1
[242,]    0
[243,]    0
[244,]    0
[245,]    1
[246,]    0
[247,]    0
[248,]    0
[249,]    0
[250,]    0
[251,]    0
[252,]    1
[253,]    0
[254,]    0
[255,]    0
[256,]    1
[257,]    0
[258,]    0
[259,]    0
[260,]    1
[261,]    1
[262,]    0
[263,]    0
[264,]    0
[265,]    1
[266,]    0
[267,]    0
[268,]    0
[269,]    0
[270,]    0
[271,]    1
[272,]    0
[273,]    0
[274,]    1
[275,]    0
[276,]    0
[277,]    0
[278,]    1
[279,]    0
[280,]    0
[281,]    0
[282,]    0
[283,]    0
[284,]    1
[285,]    1
[286,]    0
[287,]    0
[288,]    0
[289,]    1
[290,]    0
[291,]    0
[292,]    0
[293,]    1
[294,]    0
[295,]    0
[296,]    0
[297,]    0
[298,]    0
[299,]    1
[300,]    0
[301,]    0
[302,]    0
[303,]    0
[304,]    1
[305,]    0
[306,]    0
[307,]    1
[308,]    0
[309,]    0
[310,]    0
[311,]    1
[312,]    0
[313,]    0
[314,]    0
[315,]    1
[316,]    0
[317,]    0
[318,]    0
[319,]    0
[320,]    1
[321,]    1
[322,]    0
[323,]    0
[324,]    0
[325,]    0
[326,]    0
[327,]    1
[328,]    0
[329,]    0
[330,]    0
[331,]    0
[332,]    1
[333,]    0
[334,]    0
[335,]    0
[336,]    1
```

clogitboost documentation built on May 2, 2019, 6:28 a.m.