I am trying to run multinomial logistic regression on my data of supermarket monthly store data. The data looks like this
data.frame': 833233 obs. of 22 variables:
$ ProductId : num 105422 105422 143863 170645 397474 ...
$ Brand : num NA NA NA NA NA NA NA NA NA NA ...
$ Supplier : Factor w/ 788 levels "[00000] 武商量贩",..: 1 113 265 154 99 99 99 99 99 99 ...
$ Mode.of.operations : Factor w/ 3 levels "[1] Distribution",..: 1 1 1 3 2 2 2 2 2 2 ...
$ Category : Factor w/ 27 levels "[01] Fuits and Vegetables",..: 5 5 9 1 22 22 22 22 22 22 ...
$ Name : chr "土腊肉" "土腊肉" "佳品红金龙" "野山笋" ...
$ Packaging : Factor w/ 108 levels "1","2","3","4",..: 1 1 96 1 1 1 1 1 1 1 ...
$ Specs : Factor w/ 3477 levels "(1*2)","(16+5)ml",..: 3466 3466 2678 3466 92 92 92 92 92 92 ...
$ Unit : Factor w/ 72 levels "1*1","kg","Kg",..: 2 2 57 18 8 8 8 8 8 8 ...
$ Origin : Factor w/ 370 levels "409","China",..: 15 15 15 15 15 15 15 15 15 15 ...
$ Price : num 73.5 73.5 4.4 0 6.64 ...
$ Sale.quantity : num 0 0 464 0 1 0 6 0 0 0 ...
$ Sale.revenue : num 0 0 2784 0 8 ...
$ Sale.revenue.wo.tax : num 0 0 2141.54 0 5.68 ...
$ Profit.margin : num 0 0 237.95 0 1.16 ...
$ Profit.margin.percentage : num 0 0 0.1 0 0.17 ...
$ Inventory.turnover.days : num 0 0 30.2 0 1007 ...
$ Purchase.amount.wo.tax : num 0 0 0 0 0 0 0 0 0 0 ...
$ Inventory.leftover.value.wo.tax: num 111.14 0.22 1066.15 0 181.61 ...
$ Month : Factor w/ 23 levels "1","2","3","4",..: 17 17 17 17 17 17 17 17 17 17 ...
$ Adjusted.price : num 0 0 6 0 8 0 15.9 0 0 0 ...
$ Wuhan : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
I tried to find multinomial logistic regression by
model1 = multinom(Mode.of.operations ~ Category+Wuhan+Inventory.turnover.days+Adjusted.price, data = wushang, na.omit)
but i ended up with following error
Error in model.frame.default(formula = Mode.of.operations ~ Category + :
invalid type (closure) for variable '(weights)'
I tried to search for an answer to why its happening but couldn't find anything. If someone could help me figure it out please. Thanks
Allrighty, i got your error solved but i got another error. You have to put the arguments as follows:
multinom.glmulti <- function(formula, data,...) multinom(formula, data=data, maxit=10000,...)
Im using my own formula with my terms.
```{r}
formula_autom = reformulate(variables_autom_0,"clase")
And my own data.
Now we are suposed to get the models.
res <- glmulti(formula_autom, data=clase_training,
level=4, fitfunction=multinom.glmulti, crit="aicc", confsetsize=100,na.action=na.omit)
But i got an error:
Error in nobs.default(object) : no 'nobs' method is available
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.