segemented analysis in R??

#1
segmented analysis in R??

Dear Experts,
I have got a bunch of scripts which performs segmented or piecewise regression analysis in R. for some reason, I am not getting desirable output, I don't know why.
the code is:

Code:
test <- read.delim("C:/Users/Dsuresh/Desktop/h77.txt")
attach(test)
names(test)
out.lm <- lm(VPD ~ H77, data = test)
library(segmented)
o <- segmented(out.lm, seg.Z = ~ VPD, psi = NA, control = seg.control(display = F))
plot(o)
summary(o)
slope(o)
intercept(o)
dat2 = data.frame(x = VPD, y = broken.line(o)$fit)
plot(dat2)
library(ggplot2)
ggplot(dat2, aes(x = VPD, y = H77)) +
  geom_point() + ggtitle("Segmented Regression") +
  labs(x="TR",y="VPD")  + geom_line(data = dat2, color = 'blue')
for your easy understanding, I have attached my data too.
Please help me in solving this.

Thanks for your time.
 
Last edited: