I am getting this error:
Error in n2w(Par0[i], p$bounds, NULL, NULL, nbStates, inputs$estAngleMean, :
Check the parameter bounds for angle (the initial parameters should be strictly between the bounds of their parameter space).
This is my code:
stateNames <- c("encamped", "exploratory")
stepMean0 <- c(0.013,0.9216)
stepSD0 <- c(0.01,1.11)
zeromass0 <- c(0.01, 0.004)
stepPar0 <- c(stepMean0,stepSD0,zeromass0)
angleCon0 <- c(1,2)
anglePar0 <- c(angleCon0)
dist = list(step = "gamma", angle = "vm")
Par0_m1 <- list(step = stepPar0, angle = anglePar0)
m1 <-fitHMM(data=dataM, nbStates=2,
dist=dist, Par0=Par0_m1,
estAngleMean = list(angle=FALSE),
stateNames = stateNames)
m1 has an output:
step parameters:
----------------
encamped exploratory
mean 0.013173673 0.915614546
sd 0.009823547 1.115597292
zeromass 0.010918283 0.004483016
angle parameters:
-----------------
encamped exploratory
mean 0 0
concentration 0 0
and then I try to use these values to fit the second more complex model:
# Formula for transition probabilities
formula <- ~ Temp*cosinor(hour, period = 24)
# initial parameters obtained from m1
Par0_m2 <- getPar0(model=m1, formula=formula)
m2 <- fitHMM(data=dataM, nbStates=2,
dist=dist, Par0=Par0_m2$Par,
beta0=Par0_m2$beta, stateNames = stateNames,
formula=formula)
This is where the error occurs.
I have tried adjusting the initial angleCon0 values and rerunning both models; I have also inspected Par0_m2$Par:
print(Par0_m2$Par
$step
mean_1 mean_2 sd_1 sd_2 zeromass_1
0.013173673 0.915614546 0.009823547 1.115597292 0.010918283
zeromass_2
0.004483016
$angle
concentration_1 concentration_2
0 0
I don’t understand what the error is saying, nor how to resolve it.