I have a predictor variable (water height in metres) and a response variable (feeding rates of birds). The relationship between them looks similar that shown in the plot below.
iris_subtidal_effect <- iris[,3:5] 4]
library(plyr); tidal_effect <- rename(tidal_effect, c("Petal.Length" = "feeding.rate", "Petal.Width" = "water.height"))
iris_extra
tidal_effect_extra <- data.frame(Petalwater.Widthheight = sample(seq(2.5, 3, 0.1), 50, replace = T), Petalfeeding.Lengthrate = sample(seq(4, 4.5, 0.1), 50, replace = T), Species = rep("Species 4", 50))
iris_sub_extratidal_effect_extra <- rbind(iris_subtidal_effect, iris_extratidal_effect_extra)
library(ggplot2)
ggplot(iris_sub_extratidal_effect_extra, aes(Petalwater.Widthheight, Petalfeeding.Lengthrate)) + geom_point() + xlab("water.height (m)")
I'm considering cutting the predictor variablewater height into a three level factor. As can be seen in plot above, the obvious point at which to cut the predictor variable arewater height is about 0.7, 2.5 and 3, which means that the distance between the minimum/maximum values at each level of the factor are not equal
I can cut the predictor variable like this:
iris_sub_extra$Petal.Width.cut <- cut(iris_sub_extra$Petaltidal_effect_extra$water.height.cut <- cut(tidal_effect_extra$water.Widthheight, breaks = c(0, 0.7, 2.5, 3), labels = c("thin""low", "wide""mid", "very wide""high"))
And then perform this model:
lm(Petalfeeding.Lengthrate ~ Petalwater.Widthheight.cut, iris_sub_extratidal_effect_extra)
My question: is there anything wrong with cutting a predictor variablewater height into groups in which distances between the minimum/maximum values at each level of the factor are not equal?