I am trying to find the fixed point of a logistic distribution function and determine how the fixed point changes for different parameter values. The code looks like:
nfxp.reps <- 0
err <- 10
p <- seq(0, 1, by = 0.0001)
pold <- p
gamma <- 6
k <- 3
while (err > 1E-12) {
nfxp.reps <- nfxp.reps + 1
if (nfxp.reps > 999) {
stop("The number of NFXP reps needs to be increased. \n")
}
pnew <- plogis(-k + gamma * pold)
err <- max(abs(pnew - pold))
pold <- pnew
}
The above code works very well in the above parameter choices: gamma and k - find 3 fixed points, 2 stable and 1 unstable (where p=0.5). However if I change the above parameter non-proportionally, where the middle fixed point is either above or below 0.5, say for:
gamma<-7
k<-3
The loop is unable to locate the middle fixed point which is p=0.3225 (if gamma=7, k=3)