Closed roaldarbol closed 2 months ago
Do you have a reproducible example?
Sure thing:
library(tibble)
library(brms)
#> Loading required package: Rcpp
#> Loading 'brms' package (version 2.21.0). Useful instructions
#> can be found by typing help('brms'). A more detailed introduction
#> to the package is available through vignette('brms_overview').
#>
#> Attaching package: 'brms'
#> The following object is masked from 'package:stats':
#>
#> ar
library(performance)
df_ratio_episode <- tibble::tibble(
animal_id = factor(
rep(
c(
"208", "209", "210", "214", "223", "228", "211", "213", "217", "222", "234",
"241", "216", "230", "231", "240", "242", "244", "218", "220", "225", "237",
"239", "219", "251", "252", "253", "254"
),
each = 2L
),
levels = c(
"200", "204", "205", "206", "215", "224", "208", "209", "210", "214", "223",
"228", "211", "213", "217", "222", "234", "241", "216", "230", "231", "240",
"242", "244", "218", "220", "225", "237", "239", "245", "219", "236", "251",
"252", "253", "254"
)
),
trial = rep(c(1, 2), 28),
activity_ratio = c(
0.1313027016689785, 0.08387917431645128, 0.1395420340967623,
0.09844057594710427, 0.19414443290359096, 0.16304581176275632,
0.17274983272168504, 0.17357956037939837, 0.09729583968716982,
0.05138063319955499, 0.14298075594540044, 0.10179701101266003,
0.09168390375802275, 0.11591243874797318, 0.2521345405747349,
0.16335726666875724, 0.13436311090275369, 0.12012636336085161,
0.13868852567209072, 0.12008249718946021, 0.27708418835127824,
0.22042035159734397, 0.2649703945513039, 0.22158610629846917,
0.2001770607989554, 0.2238562351804714, 0.1105503693420828,
0.08255349183783911, 0.21927303214082697, 0.22211274055043914,
0.10446530203550744, 0.11336175801811256, 0.0826812722435201,
0.09328851878674252, 0.13701773797551595, 0.1297098120849381,
0.05986226055235673, 0.14423247009476106, 0.19474645802355026,
0.1713563584485577, 0.25663498351317365, 0.30249307043720924,
0.09082761877930186, 0.10402396536249521, 0.21941679494558652,
0.28459112981037343, 0.11218161441362348, 0.12449715062493952,
0.18427917423975973, 0.14845015830783756, 0.19444224064643065,
0.13471565660441723, 0.11247341287367296, 0.08660523675310272,
0.1763980204528711, 0.1049572229068965
),
) |>
dplyr::group_by(animal_id)
bayes_ratio_episode <- brms::brm(activity_ratio ~ trial + (1 | animal_id),
data = df_ratio_episode,
family = brms::Beta())
#> Compiling Stan program...
#> Trying to compile a simple C file
#> Running /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/bin/R \
#> CMD SHLIB foo.c
#> using C compiler: ‘Apple clang version 15.0.0 (clang-1500.3.9.4)’
#> using SDK: ‘’
#> clang -arch x86_64 -I"/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/include" -DNDEBUG -I"/Users/roaldarbol/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/x86_64-apple-darwin20/Rcpp/1.0.12/5ea2700d21e038ace58269ecdbeb9ec0/Rcpp/include/" -I"/Volumes/ResearchSSD/002-Tracking-1Day/.renv/library/R-4.4/x86_64-apple-darwin20/RcppEigen/include/" -I"/Volumes/ResearchSSD/002-Tracking-1Day/.renv/library/R-4.4/x86_64-apple-darwin20/RcppEigen/include/unsupported" -I"/Volumes/ResearchSSD/002-Tracking-1Day/.renv/library/R-4.4/x86_64-apple-darwin20/BH/include" -I"/Users/roaldarbol/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/x86_64-apple-darwin20/StanHeaders/2.32.7/3e1bf18c6ab1dc0a4a139bf566f78bbe/StanHeaders/include/src/" -I"/Users/roaldarbol/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/x86_64-apple-darwin20/StanHeaders/2.32.7/3e1bf18c6ab1dc0a4a139bf566f78bbe/StanHeaders/include/" -I"/Users/roaldarbol/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/x86_64-apple-darwin20/RcppParallel/5.1.7/a45594a00f5dbb073d5ec9f48592a08a/RcppParallel/include/" -I"/Users/roaldarbol/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/x86_64-apple-darwin20/rstan/2.32.6/8a5b5978f888a3477c116e0395d006f8/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DUSE_STANC3 -DSTRICT_R_HEADERS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_HAS_AUTO_PTR_ETC=0 -include '/Users/roaldarbol/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/x86_64-apple-darwin20/StanHeaders/2.32.7/3e1bf18c6ab1dc0a4a139bf566f78bbe/StanHeaders/include/stan/math/prim/fun/Eigen.hpp' -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c foo.c -o foo.o
#> In file included from <built-in>:1:
#> In file included from /Users/roaldarbol/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/x86_64-apple-darwin20/StanHeaders/2.32.7/3e1bf18c6ab1dc0a4a139bf566f78bbe/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22:
#> In file included from /Volumes/ResearchSSD/002-Tracking-1Day/.renv/library/R-4.4/x86_64-apple-darwin20/RcppEigen/include/Eigen/Dense:1:
#> In file included from /Volumes/ResearchSSD/002-Tracking-1Day/.renv/library/R-4.4/x86_64-apple-darwin20/RcppEigen/include/Eigen/Core:19:
#> /Volumes/ResearchSSD/002-Tracking-1Day/.renv/library/R-4.4/x86_64-apple-darwin20/RcppEigen/include/Eigen/src/Core/util/Macros.h:679:10: fatal error: 'cmath' file not found
#> #include <cmath>
#> ^~~~~~~
#> 1 error generated.
#> make: *** [foo.o] Error 1
#> Start sampling
#>
#> SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 1).
#> Chain 1:
#> Chain 1: Gradient evaluation took 8.2e-05 seconds
#> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.82 seconds.
#> Chain 1: Adjust your expectations accordingly!
#> Chain 1:
#> Chain 1:
#> Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
#> Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
#> Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
#> Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
#> Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
#> Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
#> Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
#> Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
#> Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
#> Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
#> Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
#> Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
#> Chain 1:
#> Chain 1: Elapsed Time: 0.381 seconds (Warm-up)
#> Chain 1: 0.287 seconds (Sampling)
#> Chain 1: 0.668 seconds (Total)
#> Chain 1:
#>
#> SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 2).
#> Chain 2:
#> Chain 2: Gradient evaluation took 2.6e-05 seconds
#> Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.26 seconds.
#> Chain 2: Adjust your expectations accordingly!
#> Chain 2:
#> Chain 2:
#> Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
#> Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
#> Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
#> Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
#> Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
#> Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
#> Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
#> Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
#> Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
#> Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
#> Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
#> Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
#> Chain 2:
#> Chain 2: Elapsed Time: 0.43 seconds (Warm-up)
#> Chain 2: 0.283 seconds (Sampling)
#> Chain 2: 0.713 seconds (Total)
#> Chain 2:
#>
#> SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 3).
#> Chain 3:
#> Chain 3: Gradient evaluation took 2.7e-05 seconds
#> Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.27 seconds.
#> Chain 3: Adjust your expectations accordingly!
#> Chain 3:
#> Chain 3:
#> Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
#> Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
#> Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
#> Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
#> Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
#> Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
#> Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
#> Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
#> Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
#> Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
#> Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
#> Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
#> Chain 3:
#> Chain 3: Elapsed Time: 0.361 seconds (Warm-up)
#> Chain 3: 0.269 seconds (Sampling)
#> Chain 3: 0.63 seconds (Total)
#> Chain 3:
#>
#> SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 4).
#> Chain 4:
#> Chain 4: Gradient evaluation took 2.7e-05 seconds
#> Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.27 seconds.
#> Chain 4: Adjust your expectations accordingly!
#> Chain 4:
#> Chain 4:
#> Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
#> Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
#> Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
#> Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
#> Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
#> Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
#> Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
#> Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
#> Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
#> Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
#> Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
#> Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
#> Chain 4:
#> Chain 4: Elapsed Time: 0.383 seconds (Warm-up)
#> Chain 4: 0.296 seconds (Sampling)
#> Chain 4: 0.679 seconds (Total)
#> Chain 4:
performance::check_model(bayes_ratio_episode)
#> Error in get(family$family)(link = family$link): unused argument (link = family$link)
Created on 2024-07-05 with reprex v2.1.0
Should be fixed in bayestestR now.
I'm attempting to run
check_model()
on a model specified withbrms()
and get the following error:If I run the same model, but with
family=gaussian()
it works.