8.1 Double hierarchical models (DHGLMs)

8.1.1 DHGLM

squid_data <- simulate_population(
  data_structure=make_structure("individual(50)",N=10),
  parameters = list(
    individual = list(
      names = c("ind_int","ind_slopes","ind_lnsd"),
      mean =c(0, 0, 0.5), 
      vcov = c(0.5, 0.1, 0.1),
      beta = c(1, 0, 0),
      functions=c(NA,NA,"exp") 
    ),
    observation =list(
      names="environment",
      beta=0.2
    ),
    residual = list(
      vcov = 1,
      beta = 0
    ),
    interactions = list(
      names = c("ind_slopes:environment","ind_lnsd:residual"),
      beta = c(1, 1)
    )
  )
)

8.1.2 Bivariate DHGLM

squid_data <- simulate_population(
  n_response=2,
  parameters = list(
    individual = list(
      names = c("ind_int1","ind_slopes1","ind_lnsd1","ind_int2","ind_slopes2","ind_lnsd2"),
      mean =c(0, 0, 0.5,0,0,1), 
      vcov = c(0.5,0.1,0.1,0.4,0.2,0.05),
      beta = matrix(c( 1,0,
                       0,0,
                       0,0,
                       0,1,
                       0,0,
                       0,0
      ), byrow=TRUE,ncol=2),
      
      functions=c(NA,NA,"exp",NA,NA,"exp") 
    ),
    observation =list(
      names="environment",
      beta=matrix(c(0.2,-0.3),ncol=2)
    ),
    residual = list(
      names = c("residual1","residual2"),
      vcov = c(1,1),
      beta = matrix(c(0,0,0,0),ncol=2)
    ),
    interactions = list(
      names = c("ind_slopes1:environment","ind_lnsd1:residual1","ind_slopes2:environment","ind_lnsd2:residual2"),
      beta = matrix(c(1,1,0,0,0,0,1,1),byrow=TRUE,ncol=2)
    )
  ),
  data_structure=make_structure("individual(50)",N=10)
)