Skip to contents

Function drglm.multinom fits multinomial logistic regressiosn model to big data sets in divide and recombine approach.

Usage

drglm.multinom(formula, data, k)

Arguments

formula

An entity belonging to the "formula" class (or one that can be transformed into that class) represents a symbolic representation of the model that needs to be adjusted. Specifics about how the model is defined can be found in the 'Details' section.

data

A data frame, list, or environment that is not required but can be provided if available.

k

Number of subsets to be used.

Value

A "Multinomial (Polytomous) Logistic Regression Model" is fitted in "Divide and Recombine" approach.

References

Karim, M. R., & Islam, M. A. (2019). Reliability and Survival Analysis. In Reliability and Survival Analysis. Venables WN, Ripley BD (2002). Modern Applied Statistics with S, Fourth edition. Springer, New York. ISBN 0-387-95457-0, https://www.stats.ox.ac.uk/pub/MASS4/.

See also

Author

MH Nayem

Examples

set.seed(123)
#Number of rows to be generated
n <- 10000
#creating dataset
dataset <- data.frame( pred_1 = round(rnorm(n, mean = 50, sd = 10)),
pred_2 = round(rnorm(n, mean = 7.5, sd = 2.1)),
pred_3 = as.factor(sample(c("0", "1"), n, replace = TRUE)),
pred_4 = as.factor(sample(c("0", "1", "2"), n, replace = TRUE)),
pred_5 = as.factor(sample(0:15, n, replace = TRUE)),
pred_6 = round(rnorm(n, mean = 60, sd = 5)))
#fitting multinomial logistic regression model
mmodel=drglm::drglm.multinom(
pred_4~ pred_1+ pred_2+ pred_3+ pred_5+ pred_6, data=dataset, k=10)
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1081.842250
#> iter  20 value 1079.724677
#> iter  30 value 1079.709082
#> final  value 1079.708962 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1084.321143
#> iter  20 value 1075.145510
#> iter  30 value 1075.060898
#> final  value 1075.059122 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1086.065933
#> iter  20 value 1080.654708
#> iter  30 value 1080.617651
#> final  value 1080.617432 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1085.721140
#> iter  20 value 1082.392343
#> iter  30 value 1082.378604
#> final  value 1082.378515 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1083.460043
#> iter  20 value 1076.975921
#> iter  30 value 1076.930816
#> final  value 1076.930268 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1086.343504
#> iter  20 value 1083.483907
#> iter  30 value 1083.429147
#> final  value 1083.428788 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1086.383304
#> iter  20 value 1079.248191
#> iter  30 value 1079.131777
#> final  value 1079.129705 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1087.658835
#> iter  20 value 1079.056688
#> iter  30 value 1078.843593
#> final  value 1078.841904 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1080.330228
#> iter  20 value 1073.171327
#> iter  30 value 1072.982368
#> final  value 1072.981502 
#> converged
#> # weights:  63 (40 variable)
#> initial  value 1098.612289 
#> iter  10 value 1082.581872
#> iter  20 value 1079.435676
#> iter  30 value 1079.288356
#> final  value 1079.287908 
#> converged
#Output
mmodel
#>                Estimate.1   Estimate.2 standard error.1 standard error.2
#> (Intercept) -0.2853539188 -0.533750309      0.352355572      0.351293926
#> pred_1       0.0038416692  0.002793053      0.002519101      0.002511803
#> pred_2       0.0082891106 -0.009496117      0.011828815      0.011781775
#> pred_31      0.0218560016  0.098556010      0.050219507      0.050048272
#> pred_51      0.1041197912  0.107943130      0.143050124      0.140461598
#> pred_52      0.0185882466  0.034426012      0.141289751      0.138335472
#> pred_53      0.2397209895  0.080935362      0.141463492      0.141642918
#> pred_54      0.0938156731 -0.031423995      0.141581660      0.141524963
#> pred_55      0.1328703482  0.033111908      0.141310183      0.140318969
#> pred_56      0.2595421380  0.084977571      0.140523643      0.140900389
#> pred_57     -0.0258373204  0.006160637      0.142934906      0.139626085
#> pred_58      0.1254919206  0.064560739      0.143771676      0.141982106
#> pred_59      0.1020629948  0.024347754      0.141325495      0.139770477
#> pred_510     0.1031342956 -0.001880707      0.142115285      0.142460092
#> pred_511     0.1036721356  0.098304574      0.141672817      0.138927665
#> pred_512     0.1629845156 -0.009769957      0.141233081      0.142472377
#> pred_513     0.0560079157  0.033235440      0.140878949      0.138964031
#> pred_514    -0.0114576021  0.056310921      0.144333825      0.140790079
#> pred_515    -0.0323858251 -0.020269661      0.143521586      0.140359894
#> pred_6      -0.0004666329  0.007235091      0.004998638      0.004979892
#>               z value.1   z value.2 Pr(>|z|).1 Pr(>|z|).2 95% lower CI.1
#> (Intercept) -0.80984648 -1.51938383 0.41802842 0.12866591   -0.975958149
#> pred_1       1.52501623  1.11197121 0.12725505 0.26615053   -0.001095677
#> pred_2       0.70075579 -0.80600053 0.48345543 0.42024255   -0.014894941
#> pred_31      0.43520940  1.96921904 0.66341044 0.04892794   -0.076572423
#> pred_51      0.72785530  0.76848855 0.46670217 0.44219699   -0.176253300
#> pred_52      0.13156118  0.24885889 0.89533139 0.80346994   -0.258334577
#> pred_53      1.69457848  0.57140423 0.09015541 0.56772567   -0.037542360
#> pred_54      0.66262589 -0.22203853 0.50757019 0.82428389   -0.183679281
#> pred_55      0.94027440  0.23597599 0.34707683 0.81345130   -0.144092521
#> pred_56      1.84696420  0.60310388 0.06475233 0.54643959   -0.015879141
#> pred_57     -0.18076285  0.04412239 0.85655373 0.96480684   -0.305984588
#> pred_58      0.87285566  0.45471039 0.38274176 0.64931761   -0.156295386
#> pred_59      0.72218388  0.17419812 0.47018143 0.86170976   -0.174929886
#> pred_510     0.72570868 -0.01320164 0.46801738 0.98946692   -0.175406544
#> pred_511     0.73177154  0.70759538 0.46430802 0.47919656   -0.174001483
#> pred_512     1.15401090 -0.06857440 0.24849570 0.94532840   -0.113827237
#> pred_513     0.39756057  0.23916578 0.69095413 0.81097704   -0.220109750
#> pred_514    -0.07938265  0.39996370 0.93672827 0.68918326   -0.294346701
#> pred_515    -0.22565125 -0.14441206 0.82147268 0.88517510   -0.313682965
#> pred_6      -0.09335200  1.45286115 0.92562392 0.14626231   -0.010263784
#>             95% lower CI.2 95% upper CI.1 95% upper CI.2
#> (Intercept)  -1.2222737520    0.405250311    0.154773134
#> pred_1       -0.0021299910    0.008779015    0.007716097
#> pred_2       -0.0325879707    0.031473162    0.013595738
#> pred_31       0.0004631993    0.120284427    0.196648820
#> pred_51      -0.1673565430    0.384492883    0.383242804
#> pred_52      -0.2367065310    0.295511070    0.305558555
#> pred_53      -0.1966796557    0.516984339    0.358550379
#> pred_54      -0.3088078254    0.371310627    0.245959836
#> pred_55      -0.2419082168    0.409833218    0.308132032
#> pred_56      -0.1911821164    0.534963417    0.361137259
#> pred_57      -0.2675014606    0.254309947    0.279822734
#> pred_58      -0.2137190764    0.407279227    0.342840554
#> pred_59      -0.2495973465    0.379055875    0.298292855
#> pred_510     -0.2810973573    0.381675135    0.277335943
#> pred_511     -0.1739886449    0.381345755    0.370597794
#> pred_512     -0.2890106853    0.439796268    0.269470771
#> pred_513     -0.2391290552    0.332125581    0.305599936
#> pred_514     -0.2196325644    0.271431497    0.332254406
#> pred_515     -0.2953699988    0.248911315    0.254830677
#> pred_6       -0.0025253173    0.009330518    0.016995500