Skip to content

Commit

Permalink
Remove second spatial effect if length(data) = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipMostert committed Aug 15, 2024
1 parent 7f7e412 commit ad9f738
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/blockedCV.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ blockedCV <- function(data, options = list(),
})))

if (method == 'Predict') {

if (any(grepl('_biasField', formula_terms)) & length(dataToUse) == 1) formula_terms <- formula_terms[!grepl('_biasField', formula_terms)]

fams <- unlist(lapply(trainLiks, function(x) x$family)) == 'cp'

Expand Down Expand Up @@ -400,7 +402,7 @@ blockedCV <- function(data, options = list(),

optionsTest <- append(options, foldOptions)
compsIntercepts <- paste0('testIntercept', 1:length(testData[[1]]),'(1)')
compPreds <- formula(paste0('~ - 1 + olikhoodvar(main = olikhoodvar, model = "offset") + ', paste0(compsIntercepts, collapse = ' + ')))
compPreds <- formula(paste0('~ - 1 + olikhoodvar(main = olikhoodvar, model = "linear") + ', paste0(compsIntercepts, collapse = ' + ')))

testModel <- try(inlabru::bru(components = compPreds,
testLike, options = optionsTest))
Expand Down

0 comments on commit ad9f738

Please sign in to comment.