1

I'm trying to estimate where the breakpoint of my lm is, but it only makes sense in my system to have a breakpoint value between 5 and 20. How can I specify psi location limits in segmented()?

psi=c(5,20) #does not work 
psi=seq(5,20,1) #also does not work.

## segmented regression on linear trend
y <- birdpred$mean
z <- birdpred$year
lin.mod <- lm(y~z)

lm.seg <- segmented(lin.mod, seg.Z=~z, psi=c(5, 20))
lm.seg$psi     ## breakpoint 

Thank you!

mccurcio
  • 1,294
  • 5
  • 25
  • 44
  • One more item I realized looking at your question, In the future try to consider writing 'reproducible questions', https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – mccurcio Mar 17 '20 at 23:52
  • Is this on the right track? https://stackoverflow.com/questions/8758646/piecewise-regression-with-r-plotting-the-segments – mccurcio Mar 17 '20 at 23:57
  • Thanks for the feedback. That does not help me. I needed to estimate where the breakpoint was constraining its values between a max and a min. Got a good answer here: [https://stats.stackexchange.com/questions/454483/how-to-define-limits-of-breakpoint-max-and-min-possible-values-in-a-linear-mod] using the mcp package. – Bruna Amaral Mar 18 '20 at 00:18

0 Answers0