R 变量'的多名称(nnet)无效类型(闭包);(重量)和#x27;
我试图对我的超市月度门店数据进行多项式逻辑回归。数据如下所示R 变量'的多名称(nnet)无效类型(闭包);(重量)和#x27;,r,logistic-regression,R,Logistic Regression,我试图对我的超市月度门店数据进行多项式逻辑回归。数据如下所示 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
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 ...
我试图通过以下方法找到多项式逻辑回归
model1 = multinom(Mode.of.operations ~ Category+Wuhan+Inventory.turnover.days+Adjusted.price, data = wushang, na.omit)
但我最终犯了以下错误
Error in model.frame.default(formula = Mode.of.operations ~ Category + :
invalid type (closure) for variable '(weights)'
我试图寻找它为什么会发生的答案,但什么也找不到。
如果有人能帮我弄清楚的话。
谢谢好吧,我解决了你的错误,但我又犯了一个错误。 你必须把论点放在下面: multinom.glmulti
type(closure)
是一个函数调用。之所以出现这种情况,是因为multinom(…)
的第三个参数应该是weights=…
,但您传递的是na.omit
,它是一个函数。如果要无序使用参数,必须命名它们,如na.action=na.omit
。
Im using my own formula with my terms.
```{r}
formula_autom = reformulate(variables_autom_0,"clase")
res <- glmulti(formula_autom, data=clase_training,
level=4, fitfunction=multinom.glmulti, crit="aicc", confsetsize=100,na.action=na.omit)