I have RedHat linux 9 with R 1.8. I'm estimating models with multinom with a dependent variable that has 3 different values. Sometimes the models run fine and I can understand the results. Sometimes when I put in another variable, I see an indication that the estimation did work, but then I can't get the summary method to work. It's like this: > votemn1 <- multinom(vote~V023022+rep+V023027+ V023131,data=nes2002) # weights: 18 (10 variable) initial value 914.045424 iter 10 value 474.831205 iter 20 value 449.612637 iter 20 value 449.612636 iter 20 value 449.612636 final value 449.612636 converged > summary(votemn1) Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : invalid variable type In this model, rep is a dichotomous (0,1) variable indicating if a person is a republican or not. If I drop that variable, the model does run and the summary method produces estimates & standard errors. > votemn2 <- multinom(vote~V023022+V023027+ V023131,data=nes2002) # weights: 15 (8 variable) initial value 917.341261 iter 10 value 529.137064 final value 527.178682 converged > summary(votemn2) Call: multinom(formula = vote ~ V023022 + V023027 + V023131, data = nes2002) Coefficients: (Intercept) V023022 V023027 V023131 3 -2.2033403 0.9227144 -0.3835378 0.017960208 5 -0.8411559 -0.1853416 -0.2174085 0.005808468 Std. Errors: (Intercept) V023022 V023027 V023131 3 0.5883961 0.07054401 0.0894393 0.05655965 5 1.2438595 0.14582161 0.1963035 0.12453307 Residual Deviance: 1054.357 AIC: 1070.357 ... -- Paul E. Johnson email: pauljohn at ukans.edu Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66045 FAX: (785) 864-5700
Prof Brian Ripley
2003-Nov-13 07:26 UTC
Don't use the names of R functions as variable names (was [R] what does this multinom (actually model.frame) error mean?)
Note that is a *model.frame* error, not a multinom one. Don't use the names of R functions as variable names! I am sure that is in the introductory documentation, and it is certainly stressed in my books. Although I cannot be sure it seems very likely (perhaps because of the scoping induced by namespaces) that your `rep' is being matched to the function. On Thu, 13 Nov 2003, Paul E. Johnson wrote:> I have RedHat linux 9 with R 1.8. > > I'm estimating models with multinom with a dependent variable that has 3 > different values. Sometimes the models run fine and I can understand > the results. > > Sometimes when I put in another variable, I see an indication that the > estimation did work, but then I can't get the summary method to work. > It's like this: > > > votemn1 <- multinom(vote~V023022+rep+V023027+ V023131,data=nes2002) > # weights: 18 (10 variable) > initial value 914.045424 > iter 10 value 474.831205 > iter 20 value 449.612637 > iter 20 value 449.612636 > iter 20 value 449.612636 > final value 449.612636 > converged > > > summary(votemn1) > Error in model.frame(formula, rownames, variables, varnames, extras, > extranames, : > invalid variable type > > In this model, rep is a dichotomous (0,1) variable indicating if a > person is a republican or not. If I drop that variable, the model does > run and the summary method produces estimates & standard errors. > > > votemn2 <- multinom(vote~V023022+V023027+ V023131,data=nes2002) > # weights: 15 (8 variable) > initial value 917.341261 > iter 10 value 529.137064 > final value 527.178682 > converged > > > summary(votemn2) > Call: > multinom(formula = vote ~ V023022 + V023027 + V023131, data = nes2002) > > Coefficients: > (Intercept) V023022 V023027 V023131 > 3 -2.2033403 0.9227144 -0.3835378 0.017960208 > 5 -0.8411559 -0.1853416 -0.2174085 0.005808468 > > Std. Errors: > (Intercept) V023022 V023027 V023131 > 3 0.5883961 0.07054401 0.0894393 0.05655965 > 5 1.2438595 0.14582161 0.1963035 0.12453307 > > Residual Deviance: 1054.357 > AIC: 1070.357 > ... > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595