Hi,
Thank you for putting this package together.
I'm trying to fit a binomial model but unsure how to specify the number of failures (or total trials).
data:
> d_sample
y2 id lat lon N
1 25 IND0070940639070004_Del_U 28.83111 77.16795 100
2 37 IND0070940639100003_Del_U 28.80293 77.12073 120
3 25 IND0070940639110007_Del_U 28.78427 77.20626 130
4 39 IND0070940639130005_Del_U 28.77438 77.16210 100
5 31 IND0070940639140018_Del_U 28.76010 77.14313 110
6 23 IND0070940639200027_Del_U 28.76169 77.01645 90
models:
I'm not specifying N here.
m1 <- glmmfields(y2 ~ as.factor(id),
data = d_sample, family = binomial(), lat = "lat", lon = "lon",
nknots = 2, iter = 500,
prior_sigma = half_t(3, 0, 3),
prior_gp_theta = half_t(3, 0, 10),
prior_gp_sigma = half_t(3, 0, 3),)
gives
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: bernoulli_logit_lpmf: n[1] is 25, but must be in the interval [0, 1] (in 'model_glmmfields' at line 224)
Surprised that is using the bernoulli_logit_lpmf instead of binomial_logit_lpmf.
Here's another model
> m2 <- glmmfields(cbind(y2, N - y2) ~ as.factor(id),
data = d_sample, family = binomial(), lat = "lat", lon = "lon",
nknots = 2, iter = 500,
prior_sigma = half_t(3, 0, 3),
prior_gp_theta = half_t(3, 0, 10),
prior_gp_sigma = half_t(3, 0, 3),)
gives
Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) :
Exception: mismatch in dimension declared and found in context; processing stage=data initialization; variable name=stationID; position=0; dims declared=(12); dims found=(6) (in 'model_glmmfields' at line 6)
Session info
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] yaml_2.2.1 pool_0.1.4.3 DBI_1.1.0 lubridate_1.7.9 readxl_1.3.1 lme4_1.1-23 Matrix_1.2-18 here_0.1
[9] styler_1.3.2 cowplot_1.0.0 broom_0.7.0 geojsonio_0.9.2 dplyr_1.0.0 ggplot2_3.3.2 glmmfields_0.1.4 Rcpp_1.0.5
Hi,
Thank you for putting this package together.
I'm trying to fit a binomial model but unsure how to specify the number of failures (or total trials).
data:
models:
I'm not specifying N here.
gives
Surprised that is using the
bernoulli_logit_lpmfinstead ofbinomial_logit_lpmf.Here's another model
gives
Session info