@@ -666,7 +666,7 @@ cross_sectional_learning_score <- function(
666666# ' Performs Monte Carlo simulations to assess parameter recovery of the
667667# ' LCA model. Useful for validating estimator performance.
668668# '
669- # ' @param true_params Named numeric vector of true parameters.
669+ # ' @param true_params Named numeric vector of strictly interior true parameters.
670670# ' For no-DK model: c(gg=, gk=, kk=, gamma=)
671671# ' For DK model: c(gg=, gk=, gd=, kk=, dg=, dk=, dd=, gamma=)
672672# ' @param n Integer. Sample size per simulation. Default 500.
@@ -735,8 +735,20 @@ validate_recovery <- function(true_params, n = 500, n_items = 2,
735735 abs(sum(class_weights ) - 1 ) > sqrt(.Machine $ double.eps )) {
736736 stop(" Latent-class weights in true_params must be probabilities that sum to 1." , call. = FALSE )
737737 }
738- if (true_params [[" gamma" ]] < 0 || true_params [[" gamma" ]] > 1 ) {
739- stop(" true_params$gamma must be a probability between 0 and 1." , call. = FALSE )
738+ if (any(class_weights == 0 | class_weights == 1 )) {
739+ stop(
740+ paste(
741+ " Latent-class weights in true_params must be strictly between 0 and 1" ,
742+ " for recovery validation."
743+ ),
744+ call. = FALSE
745+ )
746+ }
747+ if (true_params [[" gamma" ]] < = 0 || true_params [[" gamma" ]] > = 1 ) {
748+ stop(
749+ " true_params$gamma must be strictly between 0 and 1 for recovery validation." ,
750+ call. = FALSE
751+ )
740752 }
741753
742754 estimates <- with_preserved_seed(seed , {
0 commit comments