---
title: "Fitting Multinomial Logistic Regression model in Divide and Recombine approach to Large Data Sets"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{drglm_multinom}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Using the function drglm.multinom(), multinomial logistic regression models can be fitted to large data sets.
```{r setup, include=FALSE}
options(rmarkdown.html_vignette.check_title = FALSE)
```
#Generating a Data Set
```{r}
set.seed(123)
#Number of rows to be generated
n <- 1000000
#creating dataset
dataset <- data.frame(
Var_1 = round(rnorm(n, mean = 50, sd = 10)),
Var_2 = round(rnorm(n, mean = 7.5, sd = 2.1)),
Var_3 = as.factor(sample(c("0", "1"), n, replace = TRUE)),
Var_4 = as.factor(sample(c("0", "1", "2"), n, replace = TRUE)),
Var_5 = as.factor(sample(0:15, n, replace = TRUE)),
Var_6 = round(rnorm(n, mean = 60, sd = 5))
)
```
This data set contains six variables of which four of them are continuous generated from normal distribution and two of them are categorical and other one is count variable. Now we shall fit different GLMs with this data set below.
# Fitting Multinomial Logistic Regression Model
Now, we shall fit multinomial logistic regression model to the data sets assuming Var_4 as response variable and all other variables as independent ones.
```{r}
mmodel=drglm::drglm.multinom(Var_4~ Var_1+ Var_2+ Var_3+ Var_5+ Var_6,
data=dataset, k=10)
#Output
print(mmodel)
```