I am trying to run a logistic regression using the lme4 package
in Program R using the glmer function
.
However, every time I run the regression I get a error:
Error in eval(family$initialize, rho) : y values must be 0 <= y <= 1
I know this error is telling me that one of my variables need changed, however; all of my variables are numeric, so I am unsure of the issue. Normally this occurs if a variable is a character within the data frame.
Here is my regression code:
speedmod <- glmer(speed ~ HaFP + HaFPWFeed + NumFeeder + (1|trackId), data=befacorn, family=binomial(link=logit))
And here is the head of the dataframe I am using:
structure(list(trackId = c(100, 100, 13, 13, 17, 17), speed = c(116.999313,
128.9319019, 164.6205906, 141.6179845, 209.5512926, 159.5864867
), Encamped = c(27.04731971, 26.65969681, 13.82608696, 11.25608907,
22.45217391, 32.26981099), Constrained = c(48.36738257, 44.71162223,
54.33043478, 60.17745303, 40.48695652, 34.76677649), Unconstrained = c(24.58529771,
28.62868095, 31.84347826, 28.5664579, 37.06086957, 32.96341252
), dist = c(33.47023812, 30.73586278, 40.05010243, 36.29203072,
46.60945598, 39.90154752), NDP = c(6812.840821, 1454.308521,
959.0027313, 971.1027189, 766.8727274, 654.5480648), area = c(1212.470847,
58.93086937, 125.1207848, 63.17518578, 439.2532168, 182.1664135
), HaFP = c(45.05, 2.2, 12.49, 10.2, 9.6, 3.1), HaFPWFeed = c(7.58,
2.2, 9.32, 9.3, 0, 0), NumFeeder = c(14, 5, 1, 0, 1, 1)), row.names = c(NA,
6L), class = "data.frame")