Respected sir/madam can you please suggest what is an unexpected symbol in the below code for running a multinomial logistic regression model <- multinom(adoption ~ age + education + HH size + landholding + Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata) [[alternative HTML version deleted]]
Dear Nandini raj, You have a space in the variable name "HH size". I hope this helps, John John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada web: https://socialsciences.mcmaster.ca/jfox/ On 2023-03-20 1:16 p.m., Nandini raj wrote:> Respected sir/madam > can you please suggest what is an unexpected symbol in the below code for > running a multinomial logistic regression > > model <- multinom(adoption ~ age + education + HH size + landholding + > Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Usually R provides a somewhat informative error message about where, exactly, it was surprised by something. Here, I suspect (not certain, without seeing the error message) that R was objecting to the space between HH and size. R cannot tell whether that represents two different variables where you forgot the + sign, or whether it is one variable, HHsize, where you added a space. --Chris Ryan On Tue, Mar 21, 2023 at 12:47?PM Nandini raj <nandiniraj9971 at gmail.com> wrote:> Respected sir/madam > can you please suggest what is an unexpected symbol in the below code for > running a multinomial logistic regression > > model <- multinom(adoption ~ age + education + HH size + landholding + > Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
The HH Size is the problem - it doesn't follow R's rules for a name. Put backticks around it: `HH Size`. -Bill On Tue, Mar 21, 2023 at 9:47?AM Nandini raj <nandiniraj9971 at gmail.com> wrote:> Respected sir/madam > can you please suggest what is an unexpected symbol in the below code for > running a multinomial logistic regression > > model <- multinom(adoption ~ age + education + HH size + landholding + > Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Your spelling of: HH size Is two word. -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Nandini raj Sent: Monday, March 20, 2023 1:17 PM To: r-help at r-project.org Subject: [R] DOUBT Respected sir/madam can you please suggest what is an unexpected symbol in the below code for running a multinomial logistic regression model <- multinom(adoption ~ age + education + HH size + landholding + Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata) [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.