Using breakpoint analysis to estimate thermocline presence & depth in ponds (r)

70 Views Asked by At

Desperate environmental engineering PhD candidate here... (Please forgive formatting issues, etc. - This is my first post!)

Objective: In my field study, I measured temperature with pond depth. I want to use these high-frequency data to estimate the depth of my thermocline (if there is one) in r.

Problem: In p1, I'd expect the thermocline to occur at about 0.6m below the surface, but my estimated breakpoint doesn't occur at the right depth.

Fig. 1: plot of temperature with depth, shown with decreasing depth on the y-axis to mimic the cross-section of a pond:

enter image description here

Here's what I've got:

fit_glm <- glm(-Vertical.Position.m ~ Temp..C,
               data = data)
seg_fit <- segmented(fit_glm, 
                     seg.Z=~Temp..C, 
                     data=data) 
summary(seg_fit)

Which generates the following summary:

Fig. 2: The output of summary(seg_fit) showing the estimated model parameters and breakpoint x-value:

enter image description here

Yet when I plot using the following code, the breakpoint shown in the resulting plot doesn't make any sense - it looks almost like a perfect mirror image of what I'd expect.

plot(data$Temp..C, -data$Vertical.Position.m, pch=16, col='steelblue')

plot.segmented(seg_fit, dens.rug=TRUE, add=TRUE)

Fig. 3: Similar to Fig. 1 but showing the piecewise model estimated by the segmented() function:

enter image description here

Of course, once this issue is resolved, I need to calculate the depth associated with the breakpoint, so please let me know if you have ideas for how to do this. Note that I don't actually care about accurately modeling the data with a piecewise function, I really only care about identifying the thermocline.

Here are the data (published to the web from Google Sheets): https://docs.google.com/spreadsheets/d/e/2PACX-1vQnD_zliGwEOC2Wpo6Rxi3tmzB562W0_MPEsU_MuQmjqit3v61ClS5BsJfnyz5OD8pY5pwya07uE6or/pubhtml

0

There are 0 best solutions below