Skip to content

Commit 46ba956

Browse files
committed
Use custom intercept variable instead of R function default intercept.
1 parent 1286cbb commit 46ba956

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

R/generate_cell_draws_and_summarize.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ generate_cell_draws_and_summarize <- function(
100100
fe_coefficients <- latent_matrix[param_names == 'covariates', ]
101101
fe_draws <- as.matrix(id_raster_table[, cov_names, with = F]) %*% fe_coefficients
102102
} else {
103-
fe_draws <- latent_matrix[param_names == '(Intercept)', ] |>
103+
fe_draws <- latent_matrix[param_names == 'Intercept', ] |>
104104
matrix(ncol = n_samples, nrow = nrow(transformed_cell_draws), byrow = TRUE)
105105
}
106106
transformed_cell_draws <- transformed_cell_draws + fe_draws

R/prepare_inla_data_stack.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ prepare_inla_data_stack <- function(
121121
"y ~ 0 + f(covariates, model = 'iid', fixed = TRUE{constraint_suffix})"
122122
)
123123
} else {
124-
formula_string <- "y ~ 1"
124+
formula_string <- "y ~ 0 + Intercept"
125+
effects_list$Intercept <- 1
126+
obs_list$Intercept <- rep(1, nrow(input_data))
125127
}
126128

127129
## Optionally add the SPDE approximation to a Gaussian process

0 commit comments

Comments
 (0)