multinomial/conditional logit with grouped data in R - r

I'm looking for a way to fit a conditional logit on grouped data in R. I have multinomial choice counts with response- and individual-specific variables. Unfortunately, the expanded dataset would be too huge to work with it. Thus I can't use most of the packages I know, mlogit for example.
I discovered vglm from the VGAM package but it doesn't work if one explanatory variable is missing for a response category.
Has someone tried something similar in R ?
Thanks!

You can use clogit in the survival package by setting the strata to your group id.

Related

R package for multilevel modelling with categorical variables and FIML to deal with missing data

I am trying to find a package in R that will allow me to run multilevel models with a mix of both categorical (independent variables; binary and ordinal data) and continuous data, and use FIML for estimations and deal with missing data.
However, based on what i have found so far, I have not been able to find a package that allows me to do all 3 (and not use multiple imputations to deal with missing data).
enter image description here
Would appreciate any suggestions!

R, mitools::MIcombine, what is the reason for no p-values?

I am currently running a simple linear regression model with 5 multiply imputed datasets in R.
E.g. model <- with(imp, lm(outcome ~ exposure))
To pool the summary estimates I could use the command summary(mitools::MIcombine(model)) from the mitools package. However, this does not give results for p-values. I could also use the command summary(pool(model)) from the mice package and this does give results for p-values.
Because of this, I am wondering if there is a specific reason why MIcombine does not produce p-values?
After looking through the documentation, it doesn't seem like there is a particular reason that the mitools library doesn't provide p-values. Although, the package's focus is on imputation, not model results.
However, you don't need either of these packages to see your results–along with the per model p-values. I started writing this as a comment but decided to include the code. If you weren't aware...you can use base R's summary. I realize that the output of mice is comparative, as is mitools. I thought it was important enough to mention this, as well.
If the output of your call is model, then this will work.
library(tidyverse)
map(1:length(model), ~summary(model[.x]))

Is there an R function for creating an interaction plot of a panelAR model?

In order to strengthen the interpretation of an interaction term I would like to create an interaction plot.
Starting Point: I am analyzing a panel data frame with which I fitted a feasible generalized least squares model by using the panelAR function. It includes an interaction term of two continuous variables.
What I want to do: To create an interaction plot, e.g. following the style of “plot_model” from the package sjPlot (see Three-Way-Interactions: link).
Problem: I could neither find any package which supports the type of my model nor a different way to get a plot.
Question: Is there any workaround which can be used for obtaining an interaction plot or even a package which supports a panelAR model?
Since I am quite new to R I would appreciate every kind of help. Thank you very much

Using Amelia (multiple imputation) output for analysis using functions other than linear regression

Background Use of the Zelig package on Amelia output for linear regression is well outlined in the Amelia II documentation.
Problem Unfortunately, I am unable to find any documentation of how to use this output for other analysis. The problem seems to lie with how other packages see the Amelia output.
Since the Zelig package seems be able to treat all the imputations as one data set, I'd love to be able to use that single data set for manipulation with other packages (e.g., dplyr), but I'm unable to get a single data.frame out of the package.
I'm not sure if this answers your question, but you can extract the imputed datasets using:
df <- a.out$imputations[[1]]
Which will assign the first imputed dataset to the data.frame df.

Panel data with binary dependent variable in R

Is it possible to do regressions in R using a panel data set with a binary dependent variable? I am familiar with using glm for logit and probit and plm for panel data, but am not sure how to combine the two. Are there any existing code examples?
EDIT
It would also be helpful if I could figure out how to extract the matrix that plm() is using when it does a regression. For instance, you could use plm to do fixed effects, or you could create a matrix with the appropriate dummy variables and then run that through glm(). In a case like this, however, it is annoying to generate the dummies yourself and it would be easier to have plm do it for you.
The package "pglm" might be what you need.
http://cran.r-project.org/web/packages/pglm/pglm.pdf
This package offers some functions of glm-like models for panel data.
Maybe the package lme4 is what you are looking for.
It seems to be possible to run generalized regressions with fixed effects using the comand glme.
But you should be aware that panel data with binary dependent variable is different than the usual linear models.
This site may be helpful.
Best regards,
Manoel
model.frame(plmmodel)
will give you the data frame that is actually used by plm for fitting the model (i.e. after list-wise deletion if you have NAs, etc.)
I don't think that plm has implemented functions to estimate models with binary outcomes, but I may be wrong. Check out the reference manual at: http://cran.r-project.org/web/packages/plm/index.html
If I'm right, this would suggest that you can't "combine the two" without considerable work in extending the functions provided by plm.

Resources