I am trying to fit a nonspatial (PLBl) model with an age covariate for an analysis using eastern redbacked salamanders. Ultimately, the goal is to fit a PLBsecrl model, but I am having issues with some of the covariates. The study contains 19 sessions with 9 occasions each. Each session represents a spring (March-May) and fall (Sept-Nov) survey season since our species has 2 peak activity windows each year. Ideally, the dataset has 3 age groups (hatchling/juvenile = 0, subadult = 1, adult = 2). I want to group the ages so that it takes 2 years (4 sessions) for a juvenile to reach the adult stage. I created an initialage covariate which is the age of each individual when we catch it for the first time, and it can therefore equal 0, 1, 2, 3 or 4. A printed subset of my data is below:

- Code: Select all
`print(captures)`

Session ID Occasion Detector sex initialage

1 1 OxxO_CH 1 D9 F 4

2 1 OxxO_CO 1 B3 U 4

3 1 OxxR_CH 1 C10 F 2

4 1 OxxY_CO 1 A4 U 2

5 1 RxxO_CH 1 C7 U 2

6 1 RxxR_CH 1 D5 U 3

7 1 xBOx_CH 1 C3 M 4

8 1 xBRx_CH 1 E10 F 4

9 1 xBxB_CH 1 D10 F 4

10 1 xBxO_CH 1 B10 U 4

11 1 xBxR_CH 1 E2 F 4

12 1 xxBB_CH 1 D2 U 1

13 1 xxBO_CH 1 D8 M 4

14 1 xxBR_CH 1 A9 M 4

15 1 xxBx_CH 1 C5 F 4

16 1 xxBx_CO 1 A3 M 4

17 1 xxOx_CH 1 B8 F 4

18 1 xxOx_CO 1 C7 U 4

19 1 xxRx_CO 1 B6 F 4

20 1 xxRx_ECO 1 E3 U 1

Based on the age.matrix (below), it seems that age increases with each session.

- Code: Select all
`age.matrix(join(rbsCH, initialage = initialage, maximumage = 4, collapse = TRUE)`

BBBB_CO "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111222222222333333333444444444444444444444444444444444444444444444444444444"

BBBB_ECO "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111222222222333333333444444444"

BBBB/B_CO "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111222222222"

BBBBOx_CH "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111222222222333333333444444444444444444"

However, because I it takes 2 years (4 sessions) for a juvenile to reach the adult stage, I want salamanders aged 0-1 to be grouped as 0, salamanders aged 2-3 to be grouped as 1, and salamanders aged 4 to be grouped as a 2. I therefore passed the c(0,0,1,1,2) to the agecov argument in openCR.fit() based on the openCR.design helpfile (below):

agecov may be used to group ages. It should have length (or number of rows) equal to maximumage + 1.

- Code: Select all
`nonspRBSage <- openCR.fit(rbsCH, type = 'PLBl',`

agecov = c(0,0,1,1,2),

details = list(initialage = initialage,

maximumage = 4),

model = list(p~age, phi~1), ncores = 8)

When I run this model, I get output, but I also get this error message

Error in stdcovlist(object$agecov, "acov", nstrata, diff(agerange) + 1) :

number of covariate values differs from expected in one or more strata.

Similarly, the beta (and real parameter) estimates suggest that the ages are not grouped as I would expect:

- Code: Select all
`Beta parameters (coefficients)`

beta SE.beta lcl ucl

p -11.21614114 0.20254303 -11.61311819 -10.81916409

p.age1 6.03419297 0.20033012 5.64155315 6.42683279

p.age2 6.86335271 0.20033178 6.47070963 7.25599578

p.age3 6.92915819 0.20860411 6.52030164 7.33801474

p.age4 8.83266351 0.20458217 8.43168983 9.23363719

phi 0.01399294 0.04151103 -0.06736718 0.09535306

lambda -1.28406484 0.00000000 -1.28406484 -1.28406484

I have looked through the openCR pdfs and secr pdfs for a worked example of a time-varying individual covariate, but I have not had any luck. Does anyone know if one exists? Any help would be appreciated.