1

I was fitting a linear mixed effects model when I realised that my outcome variable CORRECTNESS is actually the proportion of correct responses, and so is bounded between 0 and 1, and there is I suppose a finite number of possible values it can take in my data.

It was therefore suggested to me that I use a generalized linear model with a poisson distribution. When I tried to re-run my null model with a poisson distribution I get two warnings and an error message.

My data looks like this (CORRECTNESS is a numeric variable, and ID is a factor): enter image description here

CORRECTNESS <- c(0.625, 0.375, 0.5, 1,1,0.875)
ID <- c('p01', 'p02','p03', 'p04', 'p05', 'p06')
guesses <- as.data.frame(cbind(CORRECTNESS,ID))

mdl_null <- glm(CORRECTNESS ~ (1|ID), data = guesses , family = 'poisson')

The warnings:

Warning message in Ops.factor(1, ID):
“‘|’ not meaningful for factors”Warning message in glm.fit(x = structure(numeric(0), .Dim = c(0L, 2L), .Dimnames = list(:
“no observations informative at iteration 1”

Warning message:
    “glm.fit: algorithm did not converge”

The error message is either:

Error in glm.fit(x = structure(numeric(0), .Dim = c(0L, 2L), .Dimnames = list(: object 'fit' not found

or:

Error in model.matrix.default(mt, mf, contrasts): variable 1 has no levels

Can someone help me understand? How can I run this model? Thank you.

pyring
  • 347
  • 2
  • 17
  • When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. What does your data look like? – MrFlick Jun 25 '18 at 20:19
  • Thanks MrFlick. I have added an example of what my data looks like. The desired output is a model I can run summary() on. – pyring Jun 25 '18 at 20:40
  • So you have no repeated values per block, but you want to fit a random intercept? Or what was your desired model exactly? – MrFlick Jun 25 '18 at 20:45
  • There are no repeated values per block, but there are repeated values per condition - each block consists of 16 trials containing the same items, but I don't want a random effect of item, because they are different for different participants. – pyring Jun 25 '18 at 20:53
  • Posts more accurate example. – IRTFM Jun 25 '18 at 21:02
  • that is the actual dataframe i'm using, i'm not sure what you mean by more accurate. – pyring Jun 25 '18 at 21:07
  • 1
    if all the conditions are there same you can’t really include that in the model. This model doesn’t make any sense to me. It’s unclear what you are modeling or if you have the correct data to fit such a model. Poisson regression is usually used for count data (integer values). Proportions are often modeled with logistic regression. – MrFlick Jun 25 '18 at 21:38
  • 1
    You are throwing around a lot of different concepts here: mixed-effect models, Poisson GLMs, proportion responses. Little of what you've said (or coded) makes much sense. Perhaps it's best to take a step back, and (1) clarify *what* you want to model (proportions I assume), (2) *how* you want to model it (you mention repeated measurements, which suggests a nested-effect model), and (3) clearly state which *predictor variables* you want to include in your model. Then include representative sample data (your sample dataset is too small) in your post. – Maurits Evers Jun 25 '18 at 21:57
  • Yes, I am quite confused as I am new to this stuff. It was recommended that I use Poisson regression by a more senior member of my research team, but perhaps logistic regression is more appropriate for my data. – pyring Jun 28 '18 at 10:09
  • (1) The outcome variable I want to model are proportions (of correct responses). (2 & 3) I have two conditions over four blocks, and I want to model the effect of condition and block, and their interaction - I am expecting higher proportions of correct responses in one condition than the other, and higher proportions of correct responses in each subsequent block, with an interaction such that the proportion of correct responses increases less by block in the condition with higher proportions of correct responses overall (a ceiling effect). – pyring Jun 28 '18 at 10:20

0 Answers0