I want to analyze the impact of the rain on smoking probability. I observed people in two cities on the streets and marked the following parameters: city, gender of the person, duration of observing person, how many times (s)he smokes, was it rain during observation or not. To deal with different length of observations I made the new parameter (smokes per hour (smkHour = smokes/duration)) and used the following code in R:
Model <- lmer (smkHour ~ rain + (1|city/gender))
However, there are many zeros in the smkHour. BoxCox transformation is not an option here and I found that it was possible to analyze first zeros versus non-zeros and a binomial model and after analyse non-zeros with log-transformation. Therefore, the first question:
Is it correct to analyze this data in that way?
If so, probability of zeros depends on duration of the observation (probability of smoke depends on the time of observing person). Thus, the second question:
How to take into account in the first model the duration of the observation?
Is it possible to include it to the error effect or not? Could it be like that?
smkHour2 - binomial zero/non-zero transformation of smkHour
smkHourNZ - only non-zeros of smkHour
model1 <- glmer (smkHour2 ~ rain + (duration|city/gender), family=binomial) model2 <- lmer (log(smkHourNZ) ~ rain + (1|city/gender)