Git Product home page Git Product logo

diagis's Introduction

R-CMD-check Codecov test coverage downloads cran version

diagis: Diagnostic Plot and Multivariate Summary Statistics of Weighted Samples from Importance Sampling

diagis is a small package containing functions relating weighted samples obtained for example from importance sampling. The main motivation for developing diagis was to enable easy computation of summary statistics and diagnostics of the weighted MCMC runs provided by bssm package for Bayesian state space modelling. For more broader use, the diagis package provides functions for computing weighted means, covariances, and quantiles of possibly multivariate samples, the running versions of (some of) these, as well as diagnostic plot function weight_plot for graphical diagnostic of weights. Please see vignette for more details.

diagis's People

Contributors

helske avatar

Stargazers

 avatar

Watchers

 avatar  avatar

diagis's Issues

weighted_se: na.rm doesn't work

I think I spotted a bug in weighted_se.

This works (returns .43)

x  <- c(1,2,3,4)
w <- c(.1, .1, .4, .4)
weighted_se(x, w)

This should return NA, and it does.

x[1] <- NA
weighted_se(x, w)

This shouldn't return NA but it does.
weighted_se(x, w, na.rm=TRUE)

Further, this shouldn't return NA but it does:
weighted_se(x[2:4], w[2:4], na.rm=TRUE)

This, however, works well (returns .36):
weighted_se(x[2:4], w[2:4])

My sessionInfo()

`R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] diagis_0.1.4

loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 lattice_0.20-41 dplyr_1.0.0 crayon_1.3.4
[5] grid_4.0.0 R6_2.4.1 lifecycle_0.2.0 gtable_0.3.0
[9] magrittr_1.5 coda_0.19-3 scales_1.1.1 pillar_1.4.4
[13] ggplot2_3.3.1 rlang_0.4.6 generics_0.0.2 vctrs_0.3.0
[17] ellipsis_0.3.1 tools_4.0.0 glue_1.4.1 purrr_0.3.4
[21] munsell_0.5.0 compiler_4.0.0 pkgconfig_2.0.3 colorspace_1.4-1
[25] tidyselect_1.1.0 gridExtra_2.3 tibble_3.0.1 `

SE

weighted_se gives 0 for all na sample, ought to give na, I guess?!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.