0
$\begingroup$

I am trying to determine what factors best predict/explain where deer fawns are being killed by predators based on the kill site's distance to clear-cuts (which I've grouped into three different age categories as well as a overall distance to all of the clear cuts: distcut_all, distcut_0to5, distcut_6to10, distcut_11to15) as well as a distance to the nearest trail (dist_trail). Finally, also have included a categorical habitat covariate (hab), which signifies with habitat type is most prevalent in a buffer around each kill site. I have about 300 actual kill sites (coded "1") and about 300 random "false" kill sites (coded "0"), given the name "event_code". I am using a mixed effects model because these kill sites are from 20 different individual animals and therefore are not all independent of each other (i.e., each kill site (or trial) is not a unique occurrence independent of each other kill for a given individual predator).

I ran a for() loop for all of my numeric covariates to calculate a z score because my "distance to" measurements are on different scales, with some being very small, like 1 meter, and some being 4000 meters aways (which I relabeled covariateNorm, see code below).

I have run the following code with "animal" as a mixed effect. You'll also noticed that I have include logit link:

glmm.1<-glmer(event_code~distcut_allNorm+hab+distcut_0to5Norm+distcut_6to10Norm+discut_11to15Norm+dist_trailNorm+(1|animal),
              family=binomial(link = "logit"), data=fawnkill,)

and I get the following error:

Error: Response is constant

I can find close to nothing online about why this error is occurring. Also, I would also ask that if anyone sees any errors in my thought process for doing this analysis, your advice is welcome.

$\endgroup$
4
  • $\begingroup$ It seems that (among the various combinations of covariates) the error is constant. Confirm the coding of response, and also that if you remove covariates or do other "sanity checks" is able to converge. $\endgroup$
    – AdamO
    Mar 6 '20 at 16:04
  • $\begingroup$ @AdamO, thanks for your response. Can you be more specific, I am relatively new to R? What do you mean by "confirm the coding of response"? I removed each covariate, one at a time, and tried to run, but had the same error. I will add, that all of the "random" or false kills have no animal associated with them because they are random. Could this be an issue? Could it also be an issue that certain animals only have 1 or 2 kills associated with them? $\endgroup$
    – ahomkes
    Mar 6 '20 at 16:18
  • $\begingroup$ what is the output of table(fawnkill[, 'event_code'])? $\endgroup$
    – AdamO
    Mar 6 '20 at 16:30
  • $\begingroup$ 0 1 300 303 This is what I get from that. Except of course its 0 and 1 above 300 and 303. $\endgroup$
    – ahomkes
    Mar 6 '20 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.