Predicted values from multinomial modelsĪ better way to examine the effects in a multinomial model is to look at predicted probabilities. Unfortunately, its almost impossible to interpret the coefficients here because a unit change in x has some kind of negative impact on both levels of y, but we don't know how much. The standard errors are printed below the coefficients. Our model only consists of one covariate, but we now see two intercept coefficients and two slope coefficients because the model is telling us the relationship between x and y in terms of moving from category 1 to category 2 in y and from category 1 to category 3 in y, respectively. Let's look at the output from the multinom function to see what these results look like: m1 <- multinom(y ~ x) In other words, the coefficients from a multinomial logistic model express effects in terms of moving from the baseline category of the outcome to the other levels of the outcome (essentially combining several binary logistic regression models into a single model). We might therefore rely on a multinomial model, which will give us the coefficients for x for each level of the outcome. We can plot the data to see what's going on: plot(y ~ x, col = rgb(0, 0, 0, 0.3), pch = 19)Ībline(lm(y ~ x), col = "red") # a badly fitted regression lineĬlearly, there is a relationship between x and y, but it's certainly not linear and if we tried to draw a line through through the data (i.e., the straight red regression line), many of the predicted values would be problematic because y can only take on discrete values 1,2, and 3 and, in fact, the line hardly fits the data at all. Then let's create some simple bivariate data where the outcome y takes three values set.seed(100) # Warning: package 'nnet' is in use and will not be installed Let's start by loading the package, or installing then loading it if it isn't already on our system: install.packages("nnet", repos = "") Estimating these models is not possible with glm, but can be estimated using the nnet add-on package, which is recommended and therefore simply needs to be loaded. One important, but sometimes problematic, class of regression models deals with nominal or multinomial outcomes (i.e., outcomes that are not continuous or even ordered). We can see the effects for all pairs of levels with factorplot.Multinomial Outcome Models Multinomial Outcome Models In the above, the effect of age is the effect of sexM is the effect on the binary choice between the reference (Abstain) and each non-reference level. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> (Dispersion parameter for poisson family taken to be 1) #> #> Null deviance: 3737.0 on 247 degrees of freedom #> Residual deviance: 1547.1 on 234 degrees of freedom #> AIC: 2473.1 #> #> Number of Fisher Scoring iterations: 5 Library(factorplot) data(Ornstein, package= "carData") mod #> Call: #> glm(formula = interlocks ~ log(assets) + sector + nation, family = poisson, #> data = Ornstein) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -6.7111 -2.3159 -0.4595 1.2824 6.2849 #> #> Coefficients: #> Estimate Std.
0 Comments
Leave a Reply. |