Little Bee
Little Bee

Reputation: 1225

Add the multiple regression equation to a segmented graph

I found this example helpful from RDocumentation and I'd like to explore it further. The code below was adapted from https://www.rdocumentation.org/packages/segmented/versions/0.5-2.1/topics/plot.segmented

GDD<- c(221.2765957446810000,
    309.2198581560280000,
    431.2056737588650000,
    483.6879432624110000,
    553.1914893617020000)

biom<-c(0.0000000001000000,
        0.8510638297872340,
        5.9574468085106400,
        15.3191489361702000,
        22.1276595744681000)
o<- glm(biom~GDD, family = gaussian); o
o.seg<-segmented(o, ~GDD) #single segmented covariate and one breakpoint:'psi' can be omitted
par(mfrow=c(2,1))
plot(o.seg, conf.level=0.95, shade=TRUE)
points(o.seg, link=FALSE, col=2)

I would like to find the equation that created the black segmented line and to find the joint point (red). Please see how I can do that. Any help is much appreciated.enter image description here

Upvotes: 0

Views: 79

Answers (1)

spinodal
spinodal

Reputation: 680

o.seg tells you everything you want to know. "Estimated Break-Point(s):" tells you the x-value (GDD value) of the breakpoint (red point). It is psi1.GDD = 391.3.

o.seg$coefficients tells you the line equation, which is roughly -2.14 + 0.0097*GDD*(GDD < psi1.GDD) + 0.12*GDD*(GDD >= psi1.GDD).

Upvotes: 1

Related Questions