In Julia, I would like to calculate GLM with the Binomial()and family LogitLink(). My data is three linear arrays:, xvaluesnumber hitsand number misses. I would like to talk about binomially distributed hits and misses on their positions along the x axis. I have several samples with the same x coordinates (because the data originally came from a 2D array that was flattened).
In R, I have to provide hits and misses in a two-column matrix. Something like the following works:
glm1 <- glm(cbind(hits, misses)~xvalues, family=binomial)
But in the GLM formula in Julia I cannot specify arbitrary arrays. Rather, I have to specify the columns from the data frame, and the dataframe columns cannot be 2D, it seems. So I put my data in a data framework:
data = DataFrame(xvals = xvals, hits = hits, misses = misses)
and tried things that don't work (like this):
glm1 = glm(hcat(hits, misses) ~ xvals, data, family = Binomial, link = LogitLink())
An example of the data can be downloaded here .
Any tips? Hooray, Hannes
source
share