[R] Problem with updating terms in the multinom function

Chao Liu p@ych@o||u @end|ng |rom gm@||@com
Tue Mar 30 19:27:23 CEST 2021


Dear R-help,

I am trying to add1() all interaction terms on top of a multinomial
baseline model using multinom() but it shows the error

"trying + x1:x2
Error in if (trace) { : argument is not interpretable as logical
Called from: nnet.default(X, Y, w, mask = mask, size = 0, skip = TRUE,
softmax = TRUE, censored = censored, rang = 0, ...)"

What is the problem here? I appreciate any input. Here is a reproducible
example:

require(nnet)
data <- data.frame(y=sample(1:3, 24, replace = TRUE),
        x1 = c(rep(1,12), rep(2,12)),
        x2 = rep(c(rep(1,4), rep(2,4), rep(3,4)),2),
        x3=rnorm(24),
        z1 = sample(1:10, 24, replace = TRUE))
m0 <- multinom(y ~ x1 + x2 + x3 + z1, data = data)
m1 <- add1(m0, scope = .~. + .^2, test="Chisq")

My end goal is to see which terms are appropriate to drop by later adding
the line: m1[order(add1.m1$'Pr(>Chi)'),].

Best,

Chao
ᐧ

	[[alternative HTML version deleted]]



More information about the R-help mailing list