# Fitting a multinomial regression with multiple dependent variables and random factors (R)

I have a dataset with multiple dependent variables, which are counts of about 53 different categories of debris found on beaches. I also have a variety of independent variables, some of which I am interested in as fixed effects, but others of which are probably best off as random effects. They are a mix of categorical and continuous variables, e.g. State, county, distance from north to south, number of people present, etc.

A very tiny sample data set is as follows, though there are additional factors such as distance to road, date of survey, number of people on beach, and multiple transects per site.

Counts<- as.data.frame(matrix (rpois(100,1), ncol=5))
colnames(Counts)<-c("Glass", "HardPlastic", "SoftPlastic", "PlasticBag", "Fragments")
State<-rep(c("CA","OR","WA"), each=6)
Counts$State<-c(State,"CA","OR") County<-rep((1:9), each=2) Counts$County<-c(County, 1,4)
Counts$Distance<-c(10, 15, 13, 19, 18, 23, 38, 40, 49, 44, 47, 45, 52, 53, 55, 59, 51, 53, 14, 33) Year<-rep(c("2010","2011","2012"), times=7) Counts$Year<-Year[1:20]


I would like to know whether the data vary by state, whether they change over time, and ultimately, whether the variability is higher within a site or between sites.

I think the best way to look at the data would be through a multinomial logistic regression model. I have been working in R, so I have looked at nnet (multinom) and VGAM (vglm), but it appears that neither of these support random effects. It could also be useful to have a smooth on some of the geographic data, so I've had a look at mgcv, but I can't find whether that package would support multiple dependent variables.

I have read that MCMCglmm will handle random effects, but I must admit I am a bit daunted by the complexity of how to set up the model structure, especially with respect to the priors.

My specific questions therefore are:

1. can mgcv handle multiple DVs?
2. Is there another package I have overlooked?

UPDATE:

I have found the following site: http://search.r-project.org/library/mgcv/html/mvn.html, which describes using the mvn family in mgcv as a way to run multivariate normal additive models. The model structure then for my sample data set would appear to look something like this:

b<-gam(list(Glass~s(State)+s(County),SoftPlastic~s(State)+s(County),
PlasticBag~s(State)+s(County),family=mvn(d=3),data=Counts))


If this is correct, however, the model will get enormously long and complex as additional categories are added, and furthermore, I don't believe my data are normally distributed.

In other words, I'm still very much looking for an answer to this question!

• Can you provide sample data and detail what questions you would like to answer with that data? – Vladislavs Dovgalecs Apr 19 '16 at 4:37
• what do you mean by multiple dependent variables? Do you mean there are different outcomes you would like to jointly estimate using the same set of predictors? As for the outcome in your multinomial logit model, how many values can the categorical outcome take on? – Marquis de Carabas Apr 19 '16 at 4:56
• I've provided a very small sample data set, though in the actual data set there are about 50 categories, and additionally, there are multiple transects within each site. @xeon – Alexandra Apr 19 '16 at 5:36
• As for the multiple dependent variables, I'm trying to model each of the different categories of beach debris, all of which can be anywhere from zero to a theoretically unlimited number. Perhaps my terminology might be inaccurate, if so my apologies! @marquisdecarabas – Alexandra Apr 19 '16 at 5:37
• Random effects multinomial logit in R: hlplab.wordpress.com/2009/05/07/… – kjetil b halvorsen Sep 9 '17 at 17:54