Page 1 of 1

Individual weights error with LC model

Posted: 20 Nov 2025, 16:01
by cdelosrios
Hi,

I am running a basic LC model without any covariates, just to build up towards more complex classes. I am using individual weights in my estimation. I know for sure that the weights are correctly specified since I have already estimated RPL models using those weights without issues. However, when I turn to the LC estimation, I encounter the following error:
Error en apollo_weighting(P, apollo_inputs, functionality):INTERNAL ISSUE - When applying weights at the individual level, weights should be the same for all observations of each individual
Below my full code:

Code: Select all


apollo_initialise()

# core controls
apollo_control = list(
  modelDescr      = "Latent class with continuous random parameters on Swiss route choice data",
  indivID         = "individual_id",
  nCores          = 4, 
  outputDirectory = "RESULTS/LC",
  weights    = "weights" # These weights are at the individual level
)


# PARAMETERS                                     

apollo_beta = c(
  mu_b_optout_a        = -1.095,
  sigma_b_optout_a        = 0.5,
  mu_b_optout_b        = -1.095,
  sigma_b_optout_b        = 0.5,
  mu_b_grass_low_a    = 0.227,
  sigma_b_grass_low_a    = 0.09,
  mu_b_grass_low_b    = 0.227,
  sigma_b_grass_low_b    = 0.09,
  mu_b_grass_high_a   = 0.082,
  sigma_b_grass_high_a   = 0.3,
  mu_b_grass_high_b   = -0.082,
  sigma_b_grass_high_b   = 0.3,
  mu_b_species_a      = -0.037,
  sigma_b_species_a      = 0.01,
  mu_b_species_b      = 0.037,
  sigma_b_species_b      = 0.01,
  mu_b_no_seeds_a     = -0.867,
  sigma_b_no_seeds_a     = 0.4,
  mu_b_no_seeds_b     = -0.867,
  sigma_b_no_seeds_b     = 0.4,
  mu_b_no_fert_seeds_a= 0.879, 
  sigma_b_no_fert_seeds_a= 0.4, 
  mu_b_no_fert_seeds_b= -0.879, 
  sigma_b_no_fert_seeds_b= 0.4,
  mu_b_percent_out_a  = -0.008,
  sigma_b_percent_out_a  = 0.002,
  mu_b_percent_out_b  = 0.008,
  sigma_b_percent_out_b  = 0.002,
  mu_b_payment_a      =  -4.13,
  sigma_b_payment_a     = 2,
  mu_b_payment_b      =  -4.13,
  sigma_b_payment_b      = 2,
  delta_a         =  0,
  delta_b         =  0)

### Vector with names (in quotes) of parameters to be kept fixed at their starting value in apollo_beta, use apollo_beta_fixed = c() if none
apollo_fixed = c("delta_b")

# ################################################################# #
# RANDOM COMPONENTS                                    ####
# ################################################################# #

### Set parameters for generating draws
apollo_draws = list(
  interDrawsType="halton",           
  interNDraws=500,                   
  interUnifDraws=c(),                
  interNormDraws=c("draws_tt"),    
  
  intraDrawsType="mlhs",
  intraNDraws=0,
  intraUnifDraws=c(),
  intraNormDraws=c()
)

### Create random parameters
apollo_randCoeff = function(apollo_beta, apollo_inputs){
  randcoeff = list()
  
  randcoeff[["tt_a"]] = -exp(log_tt_a_mu + log_tt_a_sig*draws_tt)
  randcoeff[["tt_b"]] = -exp(log_tt_b_mu + log_tt_b_sig*draws_tt)
  
  return(randcoeff)
}

### Set parameters for generating draws
apollo_draws = list(
  interDrawsType = "halton",
  interNDraws    = 100,
  interNormDraws = c("draws_payment","draws_optout","draws_g_low","draws_g_high","draws_species","draws_seeds","draws_seeds_fert","draws_percentout","draws_ascB")
)

### Create random parameters
# only downpay and fbound are negative log-normal, the rest are positive
apollo_randCoeff <- function(apollo_beta, apollo_inputs){
  randcoeff <- list()
  
  
  randcoeff[["b_optout_a"]]             = mu_b_optout_a + sigma_b_optout_a * draws_optout
  randcoeff[["b_grass_low_a"]]             = mu_b_grass_low_a + sigma_b_grass_low_a * draws_g_low
  randcoeff[["b_grass_high_a"]]             = mu_b_grass_high_a + sigma_b_grass_high_a * draws_g_high
  randcoeff[["b_species_a"]]             = mu_b_species_a + sigma_b_species_a * draws_species
  randcoeff[["b_no_seeds_a"]]             = mu_b_no_seeds_a + sigma_b_no_seeds_a* draws_seeds
  randcoeff[["b_no_fert_seeds_a"]]        = mu_b_no_fert_seeds_a + sigma_b_no_fert_seeds_a * draws_seeds_fert
  randcoeff[["b_percent_out_a"]]        = mu_b_percent_out_a + sigma_b_percent_out_a * draws_percentout
  
  randcoeff[["b_payment_a"]]             = exp(mu_b_payment_a + sigma_b_payment_a * draws_payment)  # positive log-normal,
  
  randcoeff[["b_optout_b"]]             = mu_b_optout_b + sigma_b_optout_b * draws_optout
  randcoeff[["b_grass_low_b"]]             = mu_b_grass_low_b + sigma_b_grass_low_b * draws_g_low
  randcoeff[["b_grass_high_b"]]             = mu_b_grass_high_b + sigma_b_grass_high_b * draws_g_high
  randcoeff[["b_species_b"]]             = mu_b_species_b + sigma_b_species_b * draws_species
  randcoeff[["b_no_seeds_b"]]             = mu_b_no_seeds_b + sigma_b_no_seeds_b * draws_seeds
  randcoeff[["b_no_fert_seeds_b"]]        = mu_b_no_fert_seeds_b + sigma_b_no_fert_seeds_b * draws_seeds_fert
  randcoeff[["b_percent_out_b"]]        = mu_b_percent_out_b + sigma_b_percent_out_b * draws_percentout
  
  randcoeff[["b_payment_b"]]             = exp(mu_b_payment_b + sigma_b_payment_b * draws_payment)  # positive log-normal,
  
  
  
  return(randcoeff)
}


# ################################################################# #
#### DEFINE LATENT CLASS COMPONENTS                              ####
# ################################################################# #

apollo_lcPars = function(apollo_beta, apollo_inputs){
  lcpars = list()
  
  # Class-specific coefficients
  lcpars[["b_optout"]]        <- list(b_optout_a,        b_optout_b)
  lcpars[["b_grass_low"]]     <- list(b_grass_low_a,     b_grass_low_b)
  lcpars[["b_grass_high"]]    <- list(b_grass_high_a,    b_grass_high_b)
  lcpars[["b_species"]]       <- list(b_species_a,       b_species_b)
  lcpars[["b_no_seeds"]]      <- list(b_no_seeds_a,      b_no_seeds_b)
  lcpars[["b_no_fert_seeds"]] <- list(b_no_fert_seeds_a, b_no_fert_seeds_b)
  lcpars[["b_percent_out"]]   <- list(b_percent_out_a,   b_percent_out_b)
  lcpars[["b_payment"]]       <- list(b_payment_a,       b_payment_b)
  
  # Class membership probabilities (no covariates)
  #lcpars[["pi_values"]]       <- list(1, exp(delta_a + delta_b*0))
  
  V=list()
  V[["class_a"]] = delta_a 
  V[["class_b"]] = delta_b
  
  classAlloc_settings = list(
    classes      = c(class_a=1, class_b=2), 
    utilities    = V
  )
  
  lcpars[["pi_values"]] = apollo_classAlloc(classAlloc_settings)
  
  return(lcpars)
}



# ################################################################# #
#### DEFINE MODEL AND LIKELIHOOD FUNCTION                        ####
# ################################################################# #

apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){
  
  ### Attach inputs and detach after function exit
  apollo_attach(apollo_beta, apollo_inputs)
  on.exit(apollo_detach(apollo_beta, apollo_inputs))
  
  ### Create list of probabilities P
  P = list()
  
  ### Define settings for MNL model component that are generic across classes
  
  mnl_settings = list(
    alternatives = c(alt1 = 1, alt2 = 2, alt3 = 3),
    avail = list(alt1 = 1, alt2 = 1, alt3 = 1),
    choiceVar     = CHOICE
  )
  
  ### Loop over classes
  for(s in 1:2){
    ### Compute class-specific utilities
    
    
    ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
    V <- list(
      alt1 = 
        b_grass_low[[s]]     * grass_low_1     +
        b_grass_high[[s]]    * grass_high_1    +
        b_species[[s]]       * Species_1       +
        b_no_seeds[[s]]      * no_seeds_1      +
        b_no_fert_seeds[[s]] * no_fert_seeds_1 +
        b_percent_out[[s]]   * percent_out_1   +
        b_payment[[s]]       * payment_1,
      alt2 = 
        b_grass_low[[s]]     * grass_low_2     +
        b_grass_high[[s]]    * grass_high_2    +
        b_species[[s]]       * Species_2       +
        b_no_seeds[[s]]      * no_seeds_2      +
        b_no_fert_seeds[[s]] * no_fert_seeds_2 +
        b_percent_out[[s]]   * percent_out_2   +
        b_payment[[s]]       * payment_2,
      alt3 = b_optout[[s]]
    )
    
    
    
    mnl_settings$utilities = V
    
    ### Compute within-class choice probabilities using MNL model
    P[[paste0("Class_",s)]] = apollo_mnl(mnl_settings, functionality)
    
    ### Apply weights before taking the product of all observations of each indiv
    P = apollo_weighting(P, apollo_inputs, functionality)
    
    ### Take product across observation for same individual
    P[[paste0("Class_",s)]] = apollo_panelProd(P[[paste0("Class_",s)]], apollo_inputs ,functionality)
    
    ### Average across inter-individual draws within classes
    P[[paste0("Class_",s)]] = apollo_avgInterDraws(P[[paste0("Class_",s)]], apollo_inputs, functionality)
  }
  
  ### Compute latent class model probabilities
  lc_settings  = list(inClassProb = P, classProb=pi_values)
  P[["model"]] = apollo_lc(lc_settings, apollo_inputs, functionality)
  
  ### Prepare and return outputs of function
  P = apollo_prepareProb(P, apollo_inputs, functionality)
  return(P)
}


# ################################################################# #
#### MODEL ESTIMATION                                            ####
# ################################################################# #


D <- read_dta("DATA/analysis/full_data_estimate.dta") %>% as.data.frame()
D <- subset(D, select = -c(choice_1, choice_2, choice_3))


# Only with the ones that completed all tasks
database <- D %>%
  group_by(individual_id) %>%
  filter(n_distinct(choice_set) == 6) 


apollo_control$modelName <- "LC_RPL_basic_w"
apollo_inputs = apollo_validateInputs()
model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
apollo_modelOutput(model)
apollo_saveOutput(model)

After running that code I get the following output

Code: Select all

> model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
Preparing user-defined functions.

Testing likelihood function...
Apollo found a model component of type classAlloc without a componentName. The name was set to "classAlloc" by default.
INFORMATION: Setting "avail" is missing, so full availability is assumed. 
Apollo found a model component of type MNL without a componentName. The name was set to "Class_1" by default.

Overview of choices for MNL model component Class_1:
                                    alt1   alt2    alt3
Times available                  2010.00 2010.0 2010.00
Times chosen                      879.00  786.0  345.00
Percentage chosen overall          43.73   39.1   17.16
Percentage chosen when available   43.73   39.1   17.16

Apollo found a model component of type MNL without a componentName. The name was set to "Class_2" by default.

Overview of choices for MNL model component Class_2:
                                    alt1   alt2    alt3
Times available                  2010.00 2010.0 2010.00
Times chosen                      879.00  786.0  345.00
Percentage chosen overall          43.73   39.1   17.16
Percentage chosen when available   43.73   39.1   17.16

Error en apollo_weighting(P, apollo_inputs, functionality): 
  INTERNAL ISSUE - When applying weights at the individual level, weights should be the same for all observations of each individual.
I have estimated the model without any weights and it works, so I know the only issue is with the weighting part. I am guessing I am not placing the weighting in the right part of the code, I followed what I was doing and worked for the RPL here.

I would really appreciate any help.

Re: Individual weights error with LC model

Posted: 29 Nov 2025, 13:25
by stephanehess
Hi

yes, you're doing it at the wrong place, I believe. I woiuld do the weigthing after the call to apollo_lc

Also, you really should not use Halton draws with so many random terms, and you need many more draws too

Hope this helps

Stephane

Re: Individual weights error with LC model

Posted: 23 Apr 2026, 15:00
by cdelosrios
Thank you.

I am coming back to this after a bit.

Indeed, agree with the draws, just trying to get a working code before doing it with the right specifications.

I tried your suggestion and I still cannot make that work. Is that what you menat or should the weighting be applied at some other point

Code: Select all


apollo_initialise()

# core controls
apollo_control = list(
  modelDescr      = "LC + RPL",
  indivID         = "individual_id",
  nCores          = 4, 
  outputDirectory = "RESULTS/LC",
  weights    = "weights" # These weights are at the individual level
)


# PARAMETERS                                     

apollo_beta = c(
  mu_b_optout_a        = 0.8,
  sigma_b_optout_a        = 0.5,
  mu_b_optout_b        = -1.9,
  sigma_b_optout_b        = 0.5,
  mu_b_grass_low_a    = 0.5,
  sigma_b_grass_low_a    = 0.1,
  mu_b_grass_low_b    = 0.16,
  sigma_b_grass_low_b    = 0.1,
  mu_b_grass_high_a   = 0.1,
  sigma_b_grass_high_a   = 0.3,
  mu_b_grass_high_b   = -0.1,
  sigma_b_grass_high_b   = 0.3,
  mu_b_species_a      = 0.005,
  sigma_b_species_a      = 0.01,
  mu_b_species_b      = 0.009,
  sigma_b_species_b      = 0.01,
  mu_b_no_seeds_a     = -0.7,
  sigma_b_no_seeds_a     = 0.4,
  mu_b_no_seeds_b     = -0.3,
  sigma_b_no_seeds_b     = 0.4,
  mu_b_no_fert_seeds_a= -0.179, 
  sigma_b_no_fert_seeds_a= 0.4, 
  mu_b_no_fert_seeds_b= -0.5, 
  sigma_b_no_fert_seeds_b= 0.4,
  mu_b_percent_out_a  = -0.005,
  sigma_b_percent_out_a  = 0.002,
  mu_b_percent_out_b  = -0.006,
  sigma_b_percent_out_b  = 0.002,
  mu_b_payment_a      =  -4.13,
  sigma_b_payment_a     = 2,
  mu_b_payment_b      =  -4.13,
  sigma_b_payment_b      = 2,
  delta_a         =  -1.2,
  delta_b         =  0)

### Vector with names (in quotes) of parameters to be kept fixed at their starting value in apollo_beta, use apollo_beta_fixed = c() if none
apollo_fixed = c("delta_b")


### Set parameters for generating draws
apollo_draws = list(
  interDrawsType = "sobol",
  interNDraws    = 1000,
  interNormDraws = c("draws_payment","draws_optout","draws_g_low","draws_g_high","draws_species","draws_seeds","draws_seeds_fert","draws_percentout","draws_ascB")
)

### Create random parameters
# only downpay and fbound are negative log-normal, the rest are positive
apollo_randCoeff <- function(apollo_beta, apollo_inputs){
  randcoeff <- list()
  
  
  randcoeff[["b_optout_a"]]             = mu_b_optout_a + sigma_b_optout_a * draws_optout
  randcoeff[["b_grass_low_a"]]             = mu_b_grass_low_a + sigma_b_grass_low_a * draws_g_low
  randcoeff[["b_grass_high_a"]]             = mu_b_grass_high_a + sigma_b_grass_high_a * draws_g_high
  randcoeff[["b_species_a"]]             = mu_b_species_a + sigma_b_species_a * draws_species
  randcoeff[["b_no_seeds_a"]]             = mu_b_no_seeds_a + sigma_b_no_seeds_a* draws_seeds
  randcoeff[["b_no_fert_seeds_a"]]        = mu_b_no_fert_seeds_a + sigma_b_no_fert_seeds_a * draws_seeds_fert
  randcoeff[["b_percent_out_a"]]        = mu_b_percent_out_a + sigma_b_percent_out_a * draws_percentout
  
  randcoeff[["b_payment_a"]]             = exp(mu_b_payment_a + sigma_b_payment_a * draws_payment)  # positive log-normal,
  
  randcoeff[["b_optout_b"]]             = mu_b_optout_b + sigma_b_optout_b * draws_optout
  randcoeff[["b_grass_low_b"]]             = mu_b_grass_low_b + sigma_b_grass_low_b * draws_g_low
  randcoeff[["b_grass_high_b"]]             = mu_b_grass_high_b + sigma_b_grass_high_b * draws_g_high
  randcoeff[["b_species_b"]]             = mu_b_species_b + sigma_b_species_b * draws_species
  randcoeff[["b_no_seeds_b"]]             = mu_b_no_seeds_b + sigma_b_no_seeds_b * draws_seeds
  randcoeff[["b_no_fert_seeds_b"]]        = mu_b_no_fert_seeds_b + sigma_b_no_fert_seeds_b * draws_seeds_fert
  randcoeff[["b_percent_out_b"]]        = mu_b_percent_out_b + sigma_b_percent_out_b * draws_percentout
  
  randcoeff[["b_payment_b"]]             = exp(mu_b_payment_b + sigma_b_payment_b * draws_payment)  # positive log-normal,
  
  
  
  return(randcoeff)
}



apollo_lcPars = function(apollo_beta, apollo_inputs){
  lcpars = list()
  
  # Class-specific coefficients
  lcpars[["b_optout"]]        <- list(b_optout_a,        b_optout_b)
  lcpars[["b_grass_low"]]     <- list(b_grass_low_a,     b_grass_low_b)
  lcpars[["b_grass_high"]]    <- list(b_grass_high_a,    b_grass_high_b)
  lcpars[["b_species"]]       <- list(b_species_a,       b_species_b)
  lcpars[["b_no_seeds"]]      <- list(b_no_seeds_a,      b_no_seeds_b)
  lcpars[["b_no_fert_seeds"]] <- list(b_no_fert_seeds_a, b_no_fert_seeds_b)
  lcpars[["b_percent_out"]]   <- list(b_percent_out_a,   b_percent_out_b)
  lcpars[["b_payment"]]       <- list(b_payment_a,       b_payment_b)
  

  
  V=list()
  V[["class_a"]] = delta_a 
  V[["class_b"]] = delta_b
  
  classAlloc_settings = list(
    classes      = c(class_a=1, class_b=2), 
    utilities    = V
  )
  
  lcpars[["pi_values"]] = apollo_classAlloc(classAlloc_settings)
  
  return(lcpars)
}



apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){
  
  ### Attach inputs and detach after function exit
  apollo_attach(apollo_beta, apollo_inputs)
  on.exit(apollo_detach(apollo_beta, apollo_inputs))
  
  ### Create list of probabilities P
  P = list()
  
  ### Define settings for MNL model component that are generic across classes
  
  mnl_settings = list(
    alternatives = c(alt1 = 1, alt2 = 2, alt3 = 3),
    avail = list(alt1 = 1, alt2 = 1, alt3 = 1),
    choiceVar     = CHOICE
  )
  
  ### Loop over classes
  for(s in 1:2){
    ### Compute class-specific utilities
    
    
    ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
    V <- list(
      alt1 = 
        b_grass_low[[s]]     * grass_low_1     +
        b_grass_high[[s]]    * grass_high_1    +
        b_species[[s]]       * Species_1       +
        b_no_seeds[[s]]      * no_seeds_1      +
        b_no_fert_seeds[[s]] * no_fert_seeds_1 +
        b_percent_out[[s]]   * percent_out_1   +
        b_payment[[s]]       * payment_1,
      alt2 = 
        b_grass_low[[s]]     * grass_low_2     +
        b_grass_high[[s]]    * grass_high_2    +
        b_species[[s]]       * Species_2       +
        b_no_seeds[[s]]      * no_seeds_2      +
        b_no_fert_seeds[[s]] * no_fert_seeds_2 +
        b_percent_out[[s]]   * percent_out_2   +
        b_payment[[s]]       * payment_2,
      alt3 = b_optout[[s]]
    )
    
    
    
    mnl_settings$utilities = V
    
    ### Compute within-class choice probabilities using MNL model
    P[[paste0("Class_",s)]] = apollo_mnl(mnl_settings, functionality)
    
    ### Take product across observation for same individual
    P[[paste0("Class_",s)]] = apollo_panelProd(P[[paste0("Class_",s)]], apollo_inputs ,functionality)
    
    ### Average across inter-individual draws within classes
    P[[paste0("Class_",s)]] = apollo_avgInterDraws(P[[paste0("Class_",s)]], apollo_inputs, functionality)
    
    ### Apply weights before taking the product of all observations of each indiv
    P = apollo_weighting(P, apollo_inputs, functionality)
  }
  
  ### Compute latent class model probabilities
  lc_settings  = list(inClassProb = P, classProb=pi_values)
  P[["model"]] = apollo_lc(lc_settings, apollo_inputs, functionality)
  
  ### Prepare and return outputs of function
  P = apollo_prepareProb(P, apollo_inputs, functionality)
  return(P)
}




After this I am still getting the same error:
Error in apollo_weighting(P, apollo_inputs, functionality) :
INTERNAL ISSUE - When applying weights at the individual level, weights should be the same for all observations of each individual.
Any help would be much appreciated

Re: Individual weights error with LC model

Posted: 23 Apr 2026, 15:50
by stephanehess
Hi

you're still applying it early. It should be after apollo_lc(lc_settings, apollo_inputs, functionality)

Stephane

Re: Individual weights error with LC model

Posted: 23 Apr 2026, 16:56
by cdelosrios
Still runnning with the same eerror when running it like this

Code: Select all


apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){
  
  ### Attach inputs and detach after function exit
  apollo_attach(apollo_beta, apollo_inputs)
  on.exit(apollo_detach(apollo_beta, apollo_inputs))
  
  ### Create list of probabilities P
  P = list()
  
  ### Define settings for MNL model component that are generic across classes
  
  mnl_settings = list(
    alternatives = c(alt1 = 1, alt2 = 2, alt3 = 3),
    avail = list(alt1 = 1, alt2 = 1, alt3 = 1),
    choiceVar     = CHOICE
  )
  
  ### Loop over classes
  for(s in 1:2){
    ### Compute class-specific utilities
    
    
    ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
    V <- list(
      alt1 = 
        b_grass_low[[s]]     * grass_low_1     +
        b_grass_high[[s]]    * grass_high_1    +
        b_species[[s]]       * Species_1       +
        b_no_seeds[[s]]      * no_seeds_1      +
        b_no_fert_seeds[[s]] * no_fert_seeds_1 +
        b_percent_out[[s]]   * percent_out_1   +
        b_payment[[s]]       * payment_1,
      alt2 = 
        b_grass_low[[s]]     * grass_low_2     +
        b_grass_high[[s]]    * grass_high_2    +
        b_species[[s]]       * Species_2       +
        b_no_seeds[[s]]      * no_seeds_2      +
        b_no_fert_seeds[[s]] * no_fert_seeds_2 +
        b_percent_out[[s]]   * percent_out_2   +
        b_payment[[s]]       * payment_2,
      alt3 = b_optout[[s]]
    )
    
    
    
    mnl_settings$utilities = V
    
    ### Compute within-class choice probabilities using MNL model
    P[[paste0("Class_",s)]] = apollo_mnl(mnl_settings, functionality)
    
    ### Take product across observation for same individual
    P[[paste0("Class_",s)]] = apollo_panelProd(P[[paste0("Class_",s)]], apollo_inputs ,functionality)
    
    ### Average across inter-individual draws within classes
    P[[paste0("Class_",s)]] = apollo_avgInterDraws(P[[paste0("Class_",s)]], apollo_inputs, functionality)
    

  }
  
  ### Compute latent class model probabilities
  lc_settings  = list(inClassProb = P, classProb=pi_values)
  P[["model"]] = apollo_lc(lc_settings, apollo_inputs, functionality)
  
  

  ### Apply weights 
  P = apollo_weighting(P, apollo_inputs, functionality)
  
  ### Prepare and return outputs of function
  P = apollo_prepareProb(P, apollo_inputs, functionality)
  return(P)
}
I also tried placing it right after lc_settings and I ran into the same error.
I re-checked my weights and they are in fact correct

Any other thoughts? Perhaps this should be run manually?

Re: Individual weights error with LC model

Posted: 24 Apr 2026, 15:47
by stephanehess
well, are your weights different across observations for the same person?

Re: Individual weights error with LC model

Posted: 28 Apr 2026, 18:34
by cdelosrios
No. I have checked this

Re: Individual weights error with LC model

Posted: 29 Apr 2026, 16:26
by stephanehess
can you share the data and code with me to investigate?

Re: Individual weights error with LC model

Posted: 12 May 2026, 13:34
by stephanehess
Hi

this was a bug that happens when your IDs are not numeric. It will be fixed in the new version, but in the meantime, if you use numeric IDs, it will work

Stephane