Running examples in ‘BayesRTMB-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: rtmb_fa
> ### Title: RTMB-based Factor Analysis Wrapper
> ### Aliases: rtmb_fa
> 
> ### ** Examples
> 
> 
>   # Prepare a subset of the BigFive dataset for factor analysis
>   data(BigFive, package = "BayesRTMB")
>   fa_data <- BigFive[, 1:10]
> 
>   # --- 1. Standard Exploratory Factor Analysis (1 Factor) ---
>   fit_fa1 <- rtmb_fa(data = fa_data, nfactors = 1)
Pre-checking model code...
Checking RTMB setup...
> 
>   # Maximum A Posteriori (MAP) estimation
>   map_fa1 <- fit_fa1$optimize()
Starting RTMB optimization...

>   map_fa1$summary()

Call:
MAP Estimation via RTMB

Negative Log-Posterior: 2485.47
Approx. Log Marginal Likelihood (Laplace): -2535.33

Point Estimates and 95% Wald CI:
       variable  Estimate  Std. Error  Lower 95%  Upper 95% 
L[BF1,Factor1]    0.05250     0.08868   -0.12130    0.22630 
L[BF2,Factor1]    0.79972     0.07145    0.65968    0.93976 
L[BF3,Factor1]   -0.13478     0.08707   -0.30542    0.03587 
L[BF4,Factor1]   -0.20465     0.08257   -0.36649   -0.04282 
L[BF5,Factor1]   -0.14443     0.08455   -0.31015    0.02128 
L[BF6,Factor1]   -0.00682     0.08660   -0.17655    0.16291 
L[BF7,Factor1]    0.84338     0.07318    0.69994    0.98681 
L[BF8,Factor1]   -0.24816     0.08298   -0.41080   -0.08551 
L[BF9,Factor1]   -0.11264     0.08648   -0.28214    0.05686 
L[BF10,Factor1]   0.21358     0.08794    0.04122    0.38593 

> 
> 
> 
>   # --- 2. Factor Analysis with Rotation and Factor Scores (2 Factors) ---
>   # Extract 2 factors, apply Promax rotation during model fitting, and calculate factor scores
>   fit_fa2 <- rtmb_fa(data = fa_data, nfactors = 2, rotate = "promax", score = TRUE)
Pre-checking model code...
Checking RTMB setup...
Error: Failed to setup MakeADFun.
[Error]: [Error in 'transform' block]
  [Message]: '*this' is not a valid 'advector' (constructed using illegal operation?)
  [Location]: Unknown location
Execution halted