Prints model created with nimbleCode()to show row indices.

print_model(model)

Arguments

model

The nimbleCode() used to define model in nimble package, possibly generated from get_classic function.

Value

A vector of characters with each row representing a line of the model. This function is meant to help with using customize_model.

Author

Daniel Eacker

Examples

# get model
scr_model = get_classic(dim_y = 2, enc_dist = "binomial",sex_sigma = TRUE,
hab_mask=TRUE,trapsClustered = TRUE)

print_model(scr_model)
#>  [1] "nimble::nimbleCode({"                                                                         
#>  [2] "for (g in 1:nSites) {"                                                                        
#>  [3] "    p0[g] ~ dunif(0, 1)"                                                                      
#>  [4] "}"                                                                                            
#>  [5] "psi_sex ~ dunif(0, 1)"                                                                        
#>  [6] "sigma[1] ~ dunif(0, sigma_upper)"                                                             
#>  [7] "sigma[2] ~ dunif(0, sigma_upper)"                                                             
#>  [8] "sigma.pixel[1] <- sigma[1]/pixelWidth"                                                        
#>  [9] "sigma.pixel[2] <- sigma[2]/pixelWidth"                                                        
#> [10] "psi ~ dunif(0, 1)"                                                                            
#> [11] "for (i in 1:M) {"                                                                             
#> [12] "    sex[i] ~ dbern(psi_sex)"                                                                  
#> [13] "    sx[i] <- sex[i] + 1"                                                                      
#> [14] "    z[i] ~ dbern(psim[i])"                                                                    
#> [15] "    psim[i] <- (1 - (1 - psi)^prop.habitat[site[i]])"                                         
#> [16] "    s[i, 1] ~ dunif(x_lower[site[i]], x_upper[site[i]])"                                      
#> [17] "    s[i, 2] ~ dunif(y_lower[site[i]], y_upper[site[i]])"                                      
#> [18] "    pOK[i] <- hab_mask[(trunc(s[i, 2]) + 1), (trunc(s[i, 1]) + 1), site[i]]"                  
#> [19] "    OK[i] ~ dbern(pOK[i])"                                                                    
#> [20] "    dist[i, 1:J] <- sqrt((s[i, 1] - X[1:J, 1, site[i]])^2 + (s[i, 2] - X[1:J, 2, site[i]])^2)"
#> [21] "    p[i, 1:J] <- p0[site[i]] * exp(-dist[i, 1:J]^2/(2 * sigma.pixel[sx[i]]^2))"               
#> [22] "}"                                                                                            
#> [23] "for (i in 1:n0) {"                                                                            
#> [24] "    for (j in 1:J) {"                                                                         
#> [25] "        y[i, j] ~ dbin(p[i, j], K)"                                                           
#> [26] "    }"                                                                                        
#> [27] "}"                                                                                            
#> [28] "for (i in (n0 + 1):M) {"                                                                      
#> [29] "    zeros[i] ~ dbern((1 - prod(1 - p[i, 1:J])^K) * z[i])"                                     
#> [30] "}"                                                                                            
#> [31] "N <- sum(z[1:M])"                                                                             
#> [32] "D <- N/A"                                                                                     
#> [33] "})"