When I tried to apply region.N command
region.N(model9b_ppo120, region=mask2, session=1)
It gave me the error
Error in pmixn[x, ] <- ifelse(knownclass > 1, ifelse(knownclass == (x + :
number of items to replace is not a multiple of replacement length
And it gives me the same error
for each session except session 5
region.N(model9b_ppo120, region=mask2, session=5)
estimate SE.estimate lcl ucl n
E.N 83.83885 4.795464 74.95447 93.7763 77
R.N 104.65917 NaN NaN NaN 77
I assume this model should produce the mean N estimate, and therefore for each year, E.N would be the same. The only thing that puzzles me is what special about session 5 might be or what might be wrong with the rest of the data given this type of error.
To estimate N for each year separately I fit the next model
model26_ppo120<-secr.fit(input, model=list(D~year, g0~h2,sigma~h2,pmix~1), method="Nelder-Mead", detectfn=0, mask=mask2, hcov = "Sex", sessioncov=session_cov)
But it gave me the following error for every single session, including session 5
region.N(model26b_ppo120, region=mask2, session=5)
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
I use R version i 4.0.1. and secr version 4.2.2.