Skip to content

Commit

Permalink
nmixture vignette; few minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Clark committed Jan 29, 2024
1 parent c83c5ec commit 9354d4b
Show file tree
Hide file tree
Showing 15 changed files with 1,551 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/add_MACor.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ add_MaCor = function(model_file,
if(any(grepl('transformed data {', model_file, fixed = TRUE))){
model_file[grep('transformed data {', model_file, fixed = TRUE)] <-
paste0('transformed data {\n',
'vector[n_series] trend_zeros = rep_vector(0.0, n_lv);')
'vector[n_lv] trend_zeros = rep_vector(0.0, n_lv);')
} else {
model_file[grep('parameters {', model_file, fixed = TRUE)[1]] <-
paste0('transformed data {\n',
'vector[n_series] trend_zeros = rep_vector(0.0, n_lv);\n',
'vector[n_lv] trend_zeros = rep_vector(0.0, n_lv);\n',
'}\nparameters {')
}

Expand Down
4 changes: 2 additions & 2 deletions R/ppc.mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ppc.mvgam = function(object, newdata, data_test, series = 1, type = 'hist',
"prop_zero"))

if(type == 'rootogram'){
if(!object$family %in% c('poisson', 'negative binomial', 'tweedie')){
if(!object$family %in% c('poisson', 'negative binomial', 'tweedie', 'nmix')){
stop('Rootograms not supported for checking non-count data',
call. = FALSE)
}
Expand Down Expand Up @@ -235,7 +235,7 @@ ppc.mvgam = function(object, newdata, data_test, series = 1, type = 'hist',
preds <- mcmc_chains(object$model_output, 'ypred')[,starts[series]:ends[series]]
}

preds <- preds[,1:length(truths)]
preds <- preds[,1:length(truths), drop = FALSE]

if(NROW(preds) > 4000){
preds <- preds[sample(1:NROW(preds), 4000, F), ]
Expand Down
1,060 changes: 1,060 additions & 0 deletions docs/articles/nmixtures.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/mvgam.dll
Binary file not shown.
Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.
487 changes: 487 additions & 0 deletions vignettes/nmixtures.Rmd

Large diffs are not rendered by default.

0 comments on commit 9354d4b

Please sign in to comment.