422 questions
Advice
0
votes
0
replies
29
views
twang mnps on multiple imputed mice dataset
Is there a way to fit the mnps function from r twang on mice imputed mids dataset ? My treatment variable is a multilevel multinomial variable.
This is my toy dataset
library(mice)
library(...
1
vote
2
answers
106
views
Using marginaleffects package to obtain marginal effects on multinomial model from nnet's multinom() function
I have a multinomial model and am trying to estimate marginal effects for my model predictors, i.e., "how does the probability of choosing option C over A change when X increases 1 unit, or when ...
2
votes
1
answer
61
views
Estimate pairwise comparisons in marginaleffects for a multinomial model with an intercept only
There's something that's trivial to do in emmeans but it eludes me in marginaleffects.
Imagine you want to estimate a multinomial logit model with nnet::multinom().
library(tidyverse)
library(nnet)
...
2
votes
1
answer
97
views
Multinomial Regression and non-functioning predicts()-function
I have to do some work in R for university and I'm stuck. When I use the predicts() function from the glm.predict package, I keep getting an error message that I don't understand. Codes that I get ...
2
votes
1
answer
311
views
Multinomial regression with statsmodels.formula.api is not working for me
Whenever I try to build a multinomial regression using the R-style formula approach in statsmodels in Python, I get ValueError: endog has evaluated to an array with multiple columns...
Here's a ...
0
votes
1
answer
110
views
Simulating a Discrete-Choice/Multinomial Model
I want to simulate a Discrete-Choice/Multinomial model. Consider the situation where I have 100 people each with four choices (1 = air, 2 = bus, 3 = car, 4 = train).
There is a baseline preference ...
0
votes
0
answers
133
views
"param = glm" gave a singular matrix warning while "param = ref" did not
I'm conducting a multinomial logistic regression model using proc logistic in SAS with around 3.6 million observations, an outcome with 5 levels, and dozens of categorical predictors. I had no issue ...
1
vote
2
answers
98
views
Simulating from Dirichlet Multinomial distribution
I would like to create a matrix of 1000 rows and 91 columns filled with integers generated by the Dirichlet Multinomial distribution.
What I have achieved so far is fine for creating only one matrix (...
0
votes
1
answer
97
views
brmultinom brglm2 vifs and dredge dont work
I am fitting a brmultinom now (instead of previous multinom), but I can not get the VIF or dredge function working on the new model. Any advise?
my code is
library(MuMIn)
options(na.action = na.fail)
...
0
votes
0
answers
131
views
Missing category in reference level in multinomial GAM with mgcv in R
Consider the multinomial GAM with mgcv in R
library(mgcv)
multinom = gam(list(sound ~ word + s(long, lat),
~ word + s(long, lat),
~ word + s(long, ...
0
votes
1
answer
453
views
Step failure (and iteration limit) in multinomial GAM with mgcv in R
I have a data set with 40 sites (long, lat) by 2 ages by 2 genders by 6 words and 6 dependent sound categories (coded 0 to 5) as simulated here:
sound <- sample(0:5, size=960, replace=T)
...
1
vote
0
answers
79
views
Error in using mlogit function: "replacement has 8 rows, data has 9"
I am trying to estimate a simple multinomial logit model. The utility of a product is given by:
U_{ij}=\beta⋅price_{ij}+fixed_effect_j+ϵ_{ij}.
I have data which contains the choices made by ...
2
votes
0
answers
80
views
Joint hypothesis test with marginaleffects::hypotheses from a nnet::multinom object
I have a multinomial logistic regression model, fitted with nnet::multinom(). My outcome has three categories and I have used one predictor in the model. Ultimately I want to jointly test the null ...
1
vote
1
answer
228
views
Estimate Dirichlet parameters from multinomial regression
I am trying to use the predicted probabilities from a multinomial regression using multinom function from the nnet package in R to estimate the parameters for a Dirichlet distribution while taking ...
0
votes
0
answers
120
views
Estimating Multinomial Logit using xlogit vs. statsmodels
I am trying to estimate a multinomial logit with Python for a discrete choice model. I come from R, where the estimation of the coefficients is the same, but not the predictions.
I am using a known ...
1
vote
0
answers
207
views
Using PSweight for multilevel variable analysis to calculate IPW
I have a data frame named "df", with a treatment variable named "treatment", which is categorical with three values (0 to 2), I also have five other covariates (cov1 to cov5; where ...
-1
votes
1
answer
45
views
usage of multinomial assign javascript? [closed]
It is possible to assign multinomial variable in javascript like
let a = 10;
let b = a = 2; // like this
console.log(`a - ${a}, b - ${b}`); // prints "a - 2, b -2"
However, I could not find ...
0
votes
1
answer
289
views
Multinomial Logistic regression in R studio
I am trying to find out factors that affect the knowledge of making Juice. I have identified Multinomial logistic regression as a suitable method.
Here is my original data.
I am following the example ...
1
vote
0
answers
160
views
Error in model.matrix.default(random, data = a) : model frame and formula mismatch in model.matrix() using "mixcat" package and "npmlt()" command
I am trying to run a Mixed Effect Multinomial Logistic Regression Model in R using mixcat package and npmlt() command. Two random effects (participant id ("id" and day ("tag") ...
2
votes
0
answers
191
views
Get the random effects values from a `mblogit` model
I want to fit a multinomial response mixed effects model. I'm using the mblogit function from the mclogit package.
From the help(mblogit) example I can fit a fixed effects model (which is structurally ...
0
votes
2
answers
1k
views
How do I create a predicted probabilities graph with confidence intervals for a multinomial logistic regression with an interaction term in R?
Is there an easier way to create a predicted probabilities graph with confidence intervals for a multinomial logistic regression with an interaction term? I have the following code below, which seems ...
0
votes
1
answer
441
views
How to pool average predictions from a multinomial regression per category in R
I want to obtain pooled average predictions per level of a categorical variable using a multinomial regression on multiple imputed data. My problem is that the pool() function seems to collapse all ...
0
votes
1
answer
234
views
Scipy Multinomial Probability Mass Function is almost always 0.0
To calculate the probability for categorical features, I was told to use the Multinoulli distribution, which is supposedly a special case of the multinomial distribution, where the number of trials is ...
2
votes
1
answer
52
views
Using rmultinom to estimate the distribution of holiday party gifts for a list of dataframes/estimates
There is a holiday party with 6 people. Each of the 6 people have an estimate for their gifts_brought, and each person has an estimate for their chance of receiving another person's gift (...
1
vote
0
answers
203
views
Multinomial Fixed effect regression
I am new to R, I am trying to run a multinomial fixed effect regression. I am using the feglm function from'fixest' package. This is the model,
reg<-feglm(diar~c1+c2+rural+c1rural+c2rural+religion+...
0
votes
1
answer
182
views
How to fit Multinomial logistic regression model with multilevel independent variables in stata or r
I have travel data consisting of a person selecting a specific mode of transport (e.g., Car) over other options (e.g., Bus, Plane, and Train) and paying a certain price for the distance he travelled. ...
0
votes
0
answers
78
views
Get linear predictor from a multinom() model in R
I have made a multinomial model using multinom() from the nnet package. I am trying to do internal validation and update the model but I need the linear predictor values from the model and I cannot ...
2
votes
5
answers
213
views
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, ...
3
votes
2
answers
341
views
Sample multinomial distribution from the log-probabilities
I have three numbers:
lp_1 <- -316480
lp_2 <- -85041
lp_3 <- -1197042
The goal is to sample a multinomial distribution with probabilities proportional to the exp(lp_i). With these numbers, ...
0
votes
0
answers
221
views
Problem using ggeffects for mclogit package
Currently trying to use ggeffects for a mmblogit object from the mclogit package, but the following messages are being shown:
> ggeffects::ggeffect(model.example)
Can't compute marginal effects, '...
1
vote
1
answer
1k
views
Multinomial regression with R; can't find some statistics
I'm currently running multinomial logistic regressions with R using nnet package; multinom function. I have 16 IV and one DV. Using the tbl_regression function i can get the contribution of each DV to ...
0
votes
1
answer
168
views
how to get multinomial regression coefficients from gamlss
I am trying to fit a mixed effects multinomial model for my 4 level categorical outcome variable (y). I am using the gamlss function from gamlss package. The call looks like:
library(mixcat)
data(&...
7
votes
2
answers
6k
views
Mixed Effect Multinomial Logistic Regression Model in R- non-bayesian approach?
I am attempting to run a multinomial logistic regression with at least 1 (but ideally 2) random effects in R and have been very unsuccessful. It seems like there are very few packages that can handle ...
2
votes
3
answers
85
views
"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 ...
1
vote
0
answers
339
views
Obtaining predicted probabilities from multinomial logistic regression using coefficients as input (not the model)
I wonder if R has a function that can compute the predicted probabilities from the multinomial logistic regression coefficients (not the model), assuming that we do not have the model and what we have ...
0
votes
0
answers
288
views
Multinomial regression without a reference level (in R)
Multinomial regressions necessitate a reference level, and one can change the reference level using options like relevel(), but is there an alternative reference, that isn't one of the levels?
My ...
3
votes
1
answer
502
views
Is there a way to estimate multinomial proportions with confidence intervals using R survey package?
I have a survey data, with categorical variables. I would like to compute the proportion for each responses in Q1, as well as generating the confidence interval or uncertainty around the estimate. Is ...
0
votes
1
answer
332
views
Anova function does not work on mblogit models?
I am running a multinomial model with hunting season as mixed effect using the mblogit function. The model runs perfectly but I cannot run the Anova function (car package) to get an analyses of ...
0
votes
0
answers
186
views
Calculate AUC and diagnostic accuracy for each outcome after mlogit in Stata
I wonder if there are Stata codes available to assess the model performance of a multinomial logistic model such as discrimination (AUC) for each outcome and diagnostic accuracy.
I am trying to fit a ...
0
votes
0
answers
448
views
Troubles when using mblogit: Error in str2lang(x) : <text>:1:13: unexpected symbol 1: .~.+Hunting season ^
I want to run a multinomial mixed model for my Msc thesis with hunting season as a random factor. I found that the mblogit function normally should be able to do the job, however, I got error.
Summary ...
0
votes
1
answer
72
views
Summary of multinom object created inside a function - Error in stats::model.frame(formula = form, data = data_est) : object 'form' not found
I want to run a multinomial regression inside a function (regression_fun) and return the multinom object to work further with that.
But the summary() of the returned object does not work but gives the ...
1
vote
0
answers
310
views
MultinomialLogit() with xlogit - ValueError: inconsistent 'y' values. Make sure the data has one choice per sample
I'm learning about multinomial logit and I have a problem running this code using xlogit.
# Long format
from xlogit.utils import wide_to_long
ATUS_data_LA_2020_Long = wide_to_long(...
1
vote
1
answer
341
views
What could cause the incorrect number of linear predictors in the multinom family of a multinomial GAM?
Consider the following model modeling nine genotypes (integer numbers) by their growth pattern (The ratio of plant height growth over plant diameter growth) over time (in day of the year).
m2 <- ...
1
vote
0
answers
280
views
Multinomial mixed effect model in R
I would like to make a multinomial model with random effects, but I don't know how.
The model would look like this: native_driftertype ~treat+(1|replica)+(1|compartment/originhive),
with ...
2
votes
1
answer
286
views
How can you get confidence intervals for expected percentages of outcomes in a multinomial regression in R?
I would like to get confidence intervals for the percentages of difference outcomes expected from an intercept only multinomial regression. The package emmeans provides confidence intervals but they ...
1
vote
1
answer
190
views
How to create predicted probability plot?
Using the debt data set from the package faraway. So basically firstly I was asked to create a model using multinom function and use ccarduse as the response and prodebt as the single covariate. Then ...
1
vote
0
answers
113
views
AutoML H2O gives multinomial result instead of binomial
I am trying to proccess the dataset kr-vs-kp using AutoML H2O. The dataset has two possible target values "nowin" and "win", so I suppose it should be binary classification. But ...
0
votes
1
answer
755
views
Manipulating labels and levels in tbl_regression (gtsummary) with multinom (nnet)
It seems the functions for manipulating labels and levels in tbl_regression tables do not work with multinom from the nnet library. Here is reproducable code with the resulting tables. Does anyone ...
1
vote
1
answer
77
views
TensorFlow.js tf.multinomial unexpected result [62083, 37917] instead of [75000, 25000]
I am using the tf.multinomial function from the TensorFlow.js library and I expect to get the result of [75000, 25000] but instead I am getting [62083, 37917]. Can someone explain why this is ...
0
votes
1
answer
121
views
R: rowwise Confidence Intervals for a Difference of Binomials
I have a table with frequencies for control and treatment group for a multinomial factor (`response'), with three levels (Negative, Neutral, Positive). I want to calculate for each levelthe difference ...