R multinomial logistic regresion, Error in eval(expr, envir, enclos) : object not found -


i have csv file on want fit multinomial regression model. dependent variable 'topic' (the first column in csv) , have 200 factors (named x0 ... x199). tried:

require(nnet)  mydata <- read.csv('data/data.csv') mydata$topic <- factor(mydata$topic) colnames(mydata) 

which results in

[1] "topic" "x0"    "x1"    "x2"    "x3"    "x4"    "x5" .... 

now want multinomial logistic regression model:

x = paste('x0', paste('+',paste('x', 1:199, sep=''), sep='', collapse=" ")) vars = paste('topic ~ ', x ,sep='', collapse=" ") print(vars) 

output:

topic ~ x0 +x1 +x2 +x3 +x4 +x5 +x6 +x7 +x8 +x9 +.... 

fitting multinomial model:

test <- multinom(vars, data=mydata, maxnwts=2000) 

output:

.... iter  80 value 23059.928035 iter  90 value 23055.453099 iter 100 value 23051.468665 final  value 23051.468665  stopped after 100 iterations 

now when ask summary of model:

summary(test) 

i error:

error in eval(expr, envir, enclos) : object 'topic' not found

however when type in exact variables instead of passing them string (the variable vars above), works. i.e.

test <- multinom('topic ~ x0 + x1 + x2', data=mydata, maxnwts=2000) 

what wrong vars contains factors , topic?


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -