R Segmented Package: "Initial" PSI outputting "NA" even though I set a PSI when running the code

17 Views Asked by At

I am aiming to estimate the breakpoint of a linear model of how animals are performing (proportion of trials correct, $propcorrect) on a causal reasoning test as they age ($agedays). The goal is to find when does the learning stop increasing and start to plateu? However, it seems not to be registering when I try to set the initial PSI estimate to run the segmented model.

I used the following code to run the lm:

causal.lm <- lm(propcorrect ~ agedays, data = causal_red_data)
summary(causal.lm)

I then used the following code to run the breakpoint analysis:

causal.seg <- segmented.lm(causal.lm, 
                    seg.Z = ~agedays, psi=97))

summary(causal.seg)

The breakpoint looks to me as if it is around 97 days, so I set psi=97. However, it is finding a breakfpoint much earlier instead (probably due to lots of uncertainty around the early days so the line dips a big before it starts steadily increasing), and the output looks like this:

#> causal.seg$psi
#>               Initial Est.   St.Err
#> psi1.agedays      NA   62 1.103706

Why does it say Initial PSI is NA, when I had set it to 97? In the example codes I looked at to learn how to do this, it always showed whatever the user had set psi equal to under "Initial". No matter what I set it to (closer to 62, farther), the Initial comes back as NA. Does this mean it is not reading/taking into to account the PSI estimate I am trying to set? Something wrong with my code?

0

There are 0 best solutions below