Skip to content

Commit

Permalink
Fix a bug in Logistic_FARMM_CV_path_par()
Browse files Browse the repository at this point in the history
  • Loading branch information
fenguoerbian committed Sep 2, 2024
1 parent 01ab10d commit a7e68a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/mm_path_solver.R
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ Logistic_FARMM_CV_path_par <- function(y_vec, x_mat, h, kn, p, rand_eff_df,
# test_pi_vec <- as.vector(x_mat_test %*% c(delta_vec, eta_stack_vec))
# loglik_test_mat[1, lam_id] <- sum(y_vec_test * test_pi_vec - log(1 + exp(test_pi_vec)))
test_pi_vec <- as.vector((x_mat_test[, 1 : h, drop = FALSE] %*% delta_vec) + (x_mat_test[, -(1 : h), drop = FALSE] %*% eta_stack_vec) * logit_weight_vec_test)
loglik_test_mat[1, lam_id] <- sum((y_vec_test * test_pi_vec - log(1 + exp(test_pi_vec))) * weight_vec_test)
loglik_test_mat[cv_id, lam_id] <- sum((y_vec_test * test_pi_vec - log(1 + exp(test_pi_vec))) * weight_vec_test)
}

# test on testing set based on post-selection estimation
Expand Down Expand Up @@ -1310,7 +1310,7 @@ Logistic_FARMM_CV_path_par <- function(y_vec, x_mat, h, kn, p, rand_eff_df,

# test_pi_vec <- as.vector(x_mat_test %*% c(delta_vec, eta_stack_vec))
test_pi_vec <- test_pi_vec1 + test_pi_vec2
loglik_test_mat[2, lam_id] <- sum((y_vec_test * test_pi_vec - log(1 + exp(test_pi_vec))) * weight_vec_test)
loglik_post_mat[cv_id, lam_id] <- sum((y_vec_test * test_pi_vec - log(1 + exp(test_pi_vec))) * weight_vec_test)
}
}else{
stop("`post_selection` must be set to `TRUE` for `Logistic_FARMM_CV_path()`!")
Expand Down

0 comments on commit a7e68a5

Please sign in to comment.