File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -2808,15 +2808,16 @@ predict.bcfmodel <- function(
28082808 )
28092809 }
28102810 if ((object $ model_params $ has_rfx_basis ) && (is.null(rfx_basis ))) {
2811- stop(" Random effects basis (rfx_basis) must be provided for this model" )
2811+ if (object $ model_params $ rfx_model_spec == " custom" ) {
2812+ stop(" Random effects basis (rfx_basis) must be provided for this model" )
2813+ }
28122814 }
2813- if (
2814- (object $ model_params $ num_rfx_basis > 0 ) &&
2815- (ncol(rfx_basis ) != object $ model_params $ num_rfx_basis )
2816- ) {
2817- stop(
2818- " Random effects basis has a different dimension than the basis used to train this model"
2819- )
2815+ if ((object $ model_params $ num_rfx_basis > 0 ) && (! is.null(rfx_basis ))) {
2816+ if (ncol(rfx_basis ) != object $ model_params $ num_rfx_basis ) {
2817+ stop(
2818+ " Random effects basis has a different dimension than the basis used to train this model"
2819+ )
2820+ }
28202821 }
28212822
28222823 # Preprocess covariates
Original file line number Diff line number Diff line change @@ -229,14 +229,13 @@ tau_hat_posterior_test <- compute_contrast_bcf_model(
229229 scale = " linear"
230230)
231231
232- # Compute the same quantity via predict
232+ # Compute the same quantity directly via predict
233233tau_hat_posterior_test_comparison <- predict(
234234 bcf_model ,
235235 X = X_test ,
236236 Z = Z_test ,
237237 propensity = pi_test ,
238238 rfx_group_ids = group_ids_test ,
239- rfx_basis = rfx_basis_test ,
240239 type = " posterior" ,
241240 terms = " cate" ,
242241 scale = " linear"
You can’t perform that action at this time.
0 commit comments