Questions tagged [multinomial]

The multinomial distribution provides a probability distribution over three or more possible outcomes. It generalizes the more fundamental binomial distribution (two outcomes).

In probability theory, the multinomial distribution generalizes the binomial distribution to three or more outcomes.

Suppose two chess players had played numerous games, from which we estimate that Player A would win with probability 0.40, Player B would win with probability 0.35, and the probability that the game ends in a draw is 0.25. The multinomial distribution can be used to answer questions like:

  1. If these two chess players played 12 games, what is the expected number of wins, losses, and draws for player A?
  2. If these two chess players play 3 games, what is the probability that A wins one, B, wins one, and they draw on the other?

Binary classification/prediction methods (such as logistic regression) can also be generalized for multinomial outcomes (i.e., three or more class labels). Multinomial logistic regression is also sometimes called a maximum entropy (MaxEnt) model.

421 questions
3
votes
2 answers

R glmnet: segmentation fault when using multinomial and pmax

I use the glmnet package to run multinomial lasso regression. When using family="multinomial and a dataset with p variables and nsamples and pmax=x a segmentation fault occurs if x is odd (if not pmax>p. In this case it is most probably ignored…
Jonas
  • 1,639
  • 1
  • 18
  • 29
3
votes
1 answer

Bad compatibility of MuMin with multinom (nnet) objects having 3 level response variables?

I face a problem when trying to use the function model.avg of the MuMin package on objects resulting from the function multinom (package nnet). Although the manual list as multinom compatible, the model.avg function doesn't return the model average…
Ludovic Duvaux
  • 307
  • 2
  • 10
3
votes
1 answer

Run nested logit regression in R

I want to run a nested logistic regression in R, but the examples I found online didn't help much. I read over an example from this website (Step by step procedure on how to run nested logistic regression in R) which is similar to my problem, but I…
Ferrari
  • 31
  • 1
  • 4
2
votes
5 answers

R: Multinomial Formula in R

I am working with the R programming language. I am trying to write an R function that can fully expand a mathematical expression (in symbolic form) of the form: (a+b+c+....)^n In the above expression, n is an integer. I want the final answer to be…
stats_noob
  • 5,401
  • 4
  • 27
  • 83
2
votes
3 answers

"multinomial expansion" of a dataset in R

Having a dataset with an arbitrary number of columns N and rows T, I would like to obtain all the columns implied by a multinomial expansion of the columns sum raised to an arbitrary degree d. To be clearer: having the following dataset as an…
oibaFox
  • 75
  • 6
2
votes
4 answers

How to find n average number of trials before criteria are met with differing probabilities per outcome?

I've spent a few days trying to figure this out and looking up tutorials, but everything I've found so far seems like it's close to what I need but don't give the results I need. I have a device that produces a single letter, A-F. For simplicity's…
2
votes
1 answer

Multinomial density function working with non-integer data?

Does anyone know why dmultinom function in R works with non-integers and what does it return in that case? See below: > dmultinom(c(0.7,0.1,0.1,0.1) ,prob = c(0.25,0.25,0.25,0.25)) [1] 0.25 > dmultinom(c(0.25,0.25,0.25,0.25) ,prob =…
Amin Shn
  • 532
  • 2
  • 11
2
votes
0 answers

R Error in mclogit::mblogit() solve.default(X[[i]], ...) : 'a' (4 x 1) must be square

I am trying to use a multinomial logistic regression model to determine how different factors influence the liklihood of several behavioral states among two species of shark. 19 individual animals, comprising two distinct species, were each tracked…
Aidan Cox
  • 21
  • 1
2
votes
1 answer

Does the function multinom() from R's nnet package fit a multinomial logistic regression, or a Poisson regression?

The documentation for the multinom() function from the nnet package in R says that it "[f]its multinomial log-linear models via neural networks" and that "[t]he response should be a factor or a matrix with K columns, which will be interpreted as…
AJV
  • 153
  • 8
2
votes
1 answer

sklearn naive bayes MultinomialNB: Why do I get only one array with coefficients although I have 2 classes?

I have trained a naive bayes MultinomialNB model to predict if an SMS is spam or not. I get 2 classes as expected: nb = MultinomialNB(alpha=0.0) nb.fit(X_train, y_train) print(nb.classes_) #Output: ['ham' 'spam'] but when I output the coefficients…
DaveVentura
  • 612
  • 5
  • 19
2
votes
1 answer

Fitting a ordinal logistic mixed effect model

How do I fit a ordinal (3 levels), logistic mixed effect model, in R? I guess it would be like a glmer except with three outcome levels. data structure patientid Viral_load Adherence audit_score visit 1520 0 …
Thandi
  • 225
  • 1
  • 2
  • 9
2
votes
1 answer

How to get the standard errors for marginal effects calculated by effects() in mlogit

I am currently conducting (conditional) multinomial logistic regression analyses using the mlogit package in R. The standard output of these models are coefficients, standard errors, and their significance level. As these coefficients can be hard to…
2
votes
0 answers

Calculate marginal effects with the "margins" function

I am trying to calculate marginal effects with the margins() function but it returns an error: Error in jacobian %*% vcov : non-conformable arguments. What is this problem? How to solve that? ml <-…
cliu
  • 933
  • 6
  • 13
2
votes
0 answers

Function that returns a hidden state given a set of observations using Python Hmmlearn Multinomial

I have been stuck on a problem regarding a python function using Multinomial HMM (from hmmlearn) for a while... The general idea is for the HMM be capable of finding the hidden state (0, 1 or 2) given a set of observations where each is composed by…
2
votes
0 answers

Problem with updating terms in the multinom function

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,…
cliu
  • 933
  • 6
  • 13