[R-sig-ME] Obtaining all effects in a multinomial regression where the grand mean is set as baseline

Daniel Rubi daniel_rubi at ymail.com
Mon Aug 15 19:38:05 CEST 2016

I have data from these set of experiments:In each experiment I infect a neuron with a rabies virus. The virus climbs backwards across the axon of the infected neuron and jumps across the synapse to the input axons of that neuron. The rabies will then express a marker gene in the input neurons it jumped to thereby labeling the input neurons to the infected target neuron. The purpose of this is thus to trace the neurons that provide input to the neurons I'm infecting (target cells), thereby creating a connectivity map of this region in the brain.In each experiment I obtain counts of all the infected input neurons. Here's a simulation of the data: (3 targets and 5 inputs):set.seed(1)
probs <- list(c(0.4,0.1,0.1,0.2,0.2),c(0.1,0.3,0.4,0.1,0.1),c(0.1,0.1,0.4,0.2,0.2))
mat <- matrix(unlist(lapply(probs,function(p) rmultinom(1, as.integer(runif(1,50,150)), p))),ncol=3)
inputs <- LETTERS[1:5]
targets <- letters[1:3]
df <- data.frame(input = c(unlist(apply(mat,2,function(x) rep(inputs ,x)))),target = rep(targets ,apply(mat,2,sum)))
What I'd like to estimate is the effect of each target neuron on these counts, relative to the grand mean. I was thinking that a multinomial regression model is appropriate in this case, where the contrasts are set to the contr.sum option:

df$input <- factor(df$input,levels=inputs)
df$target <- factor(df$target,levels=targets)
fit <- multinom(input ~ target, data = df,contrasts = list(target = "contr.sum"))
# weights:  20 (12 variable)
initial  value 505.363505 
iter  10 value 445.057386
final  value 441.645283 
convergedWhich gives me:
> summary(fit)$coefficients
  (Intercept)   target1   target2
B  0.08556288 -1.743854 1.6062660
C  0.55375003 -2.094266 1.2616939
D -0.17624590 -1.364270 0.6284231
E -0.04091248 -1.617374 0.6601274
So the effects for input A are not reported. In an lm they would be retrieved as:
But I'm wondering whether it is the same for multinom using contrasts = list(target = "contr.sum") Also, it's not clear to me whether target1 and target2 refer to targets a and b.More generally, I would like to obtain both the effects of all targets on all inputs and the associated standard errors and p-values.Thanks,Dan
	[[alternative HTML version deleted]]

More information about the R-sig-mixed-models mailing list