Skip to content

Commit

Permalink
Fix issue #243 (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
fweber144 authored Jan 8, 2022
1 parent 3392c86 commit b894b36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/cv_varsel.R
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ loo_varsel <- function(refmodel, method, nterms_max, ndraws,
for (k in seq_along(submodels)) {
mu_k <- refmodel$family$mu_fun(submodels[[k]]$sub_fit,
obs = inds,
offset = refmodel$offset)
offset = refmodel$offset[inds])
log_lik_sub <- t(refmodel$family$ll_fun(
mu_k, submodels[[k]]$dis, refmodel$y[inds], refmodel$wobs[inds]
))
Expand Down
2 changes: 2 additions & 0 deletions R/refmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ init_refmodel <- function(object, data, formula, family, ref_predfun = NULL,
newdata <- fetch_data(data, obs = obs, newdata = newdata)
if (is.null(offset)) {
offset <- rep(0, nrow(newdata))
} else {
stopifnot(length(offset) %in% c(1L, nrow(newdata)))
}
family$linkinv(proj_predfun(fit, newdata = newdata) + offset)
}
Expand Down

0 comments on commit b894b36

Please sign in to comment.