3
$\begingroup$

I am studying how well I can predict the height above ground (km) of an animal (=bird) using a technique (method B) which samples data every certain time-intervals. To do so, I placed two devices that measure the animal' height in 6 different individuals. One of them (Device A) measures the height above the ground in continuous (one data per second), the other device (Device B) measures the height once every 5 minutes. One particularity is that while device A is retrieved from the animal, method B sends data using electromagnetic waves, so when the animal is hidden, you don't get this activity value since the signal doesn't arrive to the satellites (this record is missed). Here, I considered a value as the "True" height value.

I built a data frame (n=3960) in which I calculated the mean height of my animals above the ground at one-hour time intervals using method A (variable a) and method B (variable b). I added to this dataframe a variable called n.b which indicates the number of values I got using method B in that one-hour time interval.

head(df)

DateTime                ID       a        b      n.b

2016-08-09 11:00:00      1     0.286    0.367     12
2016-08-09 12:00:00      1     0.686    0.567     2
2016-08-09 13:00:00      1     1.386    0.967     6
          .              .       .        .       .
          .              .       .        .       .

I want to know the performance of method B when calculating the mean height of my animals, and I want to know if it is important the number of records (n.b) to get good estimations. The relationship between a and b is reflected in Plot 1, where I categorised n.b only for visualization porpuses:

enter image description here

Since I have 6 individuals, my response variable (a) has a non-normal distribution (plot 2) and its range of values is from 0.01 to 4.5, I decided to use a GLMM with a gamma distribution and compare models by AIC. I scaled my predictors since I included interactions. The initial model was like this:

m1 <- glmer(a~ 1 + (b|ID),data = df, family=Gamma(link=log))
m2 <- glmer(a~ b + (b|ID),data = df, family=Gamma(link=log))
m3 <- glmer(a~ b + n.b +  (b|ID),data = df, family=Gamma(link=log))
m4 <- glmer(a~ b + n.b +  b:n.b + (b|ID),data = df, family=Gamma(link=log))

AIC(m1,m2,m3,m4)
     df       AIC
mod1  4 -6452.035
mod2  8 -7022.316
mod3  9 -7030.324
mod4 10 -7099.915

However, as you can see in plot 3, I get obvious residuals patterns with this model (note: predicted values have negative values because I scaled my predictors).

enter image description here

Then, as suggested in this other post, I included "natural splines" in my generalized linear mixed-effects model.

m1 <- glmer(a~ 1 + (b|ID),data = df, family=Gamma(link=log))
m2 <- glmer(a~ ns(b,4) + (b|ID),data = df, family=Gamma(link=log))
m3 <- glmer(a~ ns(b,4) + n.b +  (b|ID),data = df, family=Gamma(link=log))
m4 <- glmer(a~ ns(b,4) + n.b +  b:n.b + (b|ID),data = df, family=Gamma(link=log))

As you can see (Plot 4), the residuals improve a lot for m4. However, I don't remove patterns in residuals completely, since, at low activity values, there are higher residuals for a small proportion of data. I tried tens of settings for my model (changing the random effects, etc).

enter image description here

My question is, would it be justified if I validate m4 as a good model here independently of the residuals plot? The point is that the residuals' variance is higher at low heights according to method B (X axis), but if you look at Plot 1 you see that all the "outliers" are when the number of records are low, which means that there the estimation of the height was bad in these specific situations, and which is related to my animal's behaviour. Here, what I want is to calculate the variance of a explained by b (=r2m), to understand how well works method B, and then compared that with the r2m of a model which does not use n.b, to also understand how much importance n.b has for having good predictions. Thus, I don't know if r2m and AIC might be little affected by these residual patterns or not.

Does anyone know something about that?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.