diff --git a/R/data.R b/R/data.R index ea61fd7..acc3d30 100644 --- a/R/data.R +++ b/R/data.R @@ -151,6 +151,28 @@ #' Model of class stanreg "stanreg_lm_3" +#' stanreg_lm_4 +#' +#' Model of class stanreg +"stanreg_lm_4" + +#' stanreg_lm_5 +#' +#' Model of class stanreg +"stanreg_lm_5" + +#' stanreg_lm_6 +#' +#' Model of class stanreg +"stanreg_lm_6" + +#' stanreg_lm_7 +#' +#' Model of class stanreg +"stanreg_lm_7" + + + #' stanreg_glm_1 #' #' Model of class stanreg diff --git a/README.Rmd b/README.Rmd index ef0d2a5..d2790d0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -14,7 +14,7 @@ editor_options: # circus -```{r, echo = FALSE} +```{r, echo = FALSE, results='hide', message=FALSE, warning=FALSE} knitr::opts_chunk$set( collapse = TRUE, tidy.opts=list(width.cutoff=60), @@ -24,6 +24,11 @@ knitr::opts_chunk$set( options(knitr.kable.NA = '', digits = 4, width=60) + +library(rstanarm) +rstan::rstan_options(auto_write = TRUE) +options(mc.cores = parallel::detectCores(), + digits=2) ``` @@ -56,7 +61,7 @@ library("circus") ## Models Creation ### Base -```{r, eval=FALSE, warning=FALSE, message=FALSE, results="hide"} +```{r, eval=TRUE, warning=FALSE, message=FALSE, results="hide"} htest_1 <- cor.test(iris$Sepal.Width, iris$Sepal.Length, method = "spearman") htest_2 <- cor.test(iris$Sepal.Width, iris$Sepal.Length, method = "pearson") htest_3 <- cor.test(iris$Sepal.Width, iris$Sepal.Length, method = "kendall") @@ -82,7 +87,7 @@ glm_2 <- glm(vs ~ wt + cyl, data = mtcars, family=binomial(link="probit")) ### lme4 -```{r, eval=FALSE, warning=FALSE, message=FALSE, results="hide"} +```{r, eval=TRUE, warning=FALSE, message=FALSE, results="hide"} library(lme4) lmerMod_1 <- lme4::lmer(wt ~ cyl + (1|gear), data = mtcars) @@ -93,13 +98,20 @@ merMod_2 <- lme4::glmer(vs ~ cyl + (1|gear), data = mtcars, family=binomial(link ### Rstanarm -```{r, eval=FALSE, warning=FALSE, message=FALSE, results="hide"} +```{r, eval=TRUE, warning=FALSE, message=FALSE, results="hide"} +set.seed(333) + library(rstanarm) stanreg_lm_1 <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars, chains=2) stanreg_lm_2 <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars, algorithm="meanfield") stanreg_lm_3 <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars, algorithm="fullrank") +stanreg_lm_4 <- rstanarm::stan_glm(Sepal.Length ~ Species, data = iris, chains=2) +stanreg_lm_5 <- rstanarm::stan_glm(Sepal.Length ~ Species + Petal.Length, data = iris, chains=2) +stanreg_lm_6 <- rstanarm::stan_glm(Sepal.Length ~ Species * Petal.Length, data = iris, chains=2) +stanreg_lm_7 <- rstanarm::stan_glm(Sepal.Length ~ Species / Petal.Length, data = iris, chains=2) + stanreg_glm_1 <- rstanarm::stan_glm(vs ~ wt + cyl, data = mtcars, family="binomial", chains=2) stanreg_glm_2 <- rstanarm::stan_glm(vs ~ wt + cyl, data = mtcars, family=binomial(link="probit"), chains=2) @@ -113,7 +125,7 @@ stanreg_gam_1 <- rstanarm::stan_gamm4(mpg ~ s(wt) + cyl, data = mtcars, chains=2 ## Save -```{r, eval=FALSE, warning=FALSE, message=FALSE, results="hide"} +```{r, eval=TRUE, warning=FALSE, message=FALSE, results="hide"} usethis::use_data(htest_1, htest_2, htest_3, @@ -143,6 +155,10 @@ usethis::use_data(htest_1, stanreg_lm_1, stanreg_lm_2, stanreg_lm_3, + stanreg_lm_4, + stanreg_lm_5, + stanreg_lm_6, + stanreg_lm_7, stanreg_glm_1, stanreg_glm_2, stanreg_lmerMod_1, diff --git a/README.md b/README.md index 7526207..b3004d6 100644 --- a/README.md +++ b/README.md @@ -61,12 +61,19 @@ merMod_2 <- lme4::glmer(vs ~ cyl + (1|gear), data = mtcars, family=binomial(link ### Rstanarm ``` r +set.seed(333) + library(rstanarm) stanreg_lm_1 <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars, chains=2) stanreg_lm_2 <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars, algorithm="meanfield") stanreg_lm_3 <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars, algorithm="fullrank") +stanreg_lm_4 <- rstanarm::stan_glm(Sepal.Length ~ Species, data = iris, chains=2) +stanreg_lm_5 <- rstanarm::stan_glm(Sepal.Length ~ Species + Petal.Length, data = iris, chains=2) +stanreg_lm_6 <- rstanarm::stan_glm(Sepal.Length ~ Species * Petal.Length, data = iris, chains=2) +stanreg_lm_7 <- rstanarm::stan_glm(Sepal.Length ~ Species / Petal.Length, data = iris, chains=2) + stanreg_glm_1 <- rstanarm::stan_glm(vs ~ wt + cyl, data = mtcars, family="binomial", chains=2) stanreg_glm_2 <- rstanarm::stan_glm(vs ~ wt + cyl, data = mtcars, family=binomial(link="probit"), chains=2) @@ -109,6 +116,10 @@ usethis::use_data(htest_1, stanreg_lm_1, stanreg_lm_2, stanreg_lm_3, + stanreg_lm_4, + stanreg_lm_5, + stanreg_lm_6, + stanreg_lm_7, stanreg_glm_1, stanreg_glm_2, stanreg_lmerMod_1, diff --git a/data/stanreg_gam_1.rda b/data/stanreg_gam_1.rda index 6bc7db6..0eef17d 100644 Binary files a/data/stanreg_gam_1.rda and b/data/stanreg_gam_1.rda differ diff --git a/data/stanreg_glm_1.rda b/data/stanreg_glm_1.rda index a44c108..55f2209 100644 Binary files a/data/stanreg_glm_1.rda and b/data/stanreg_glm_1.rda differ diff --git a/data/stanreg_glm_2.rda b/data/stanreg_glm_2.rda index bc89d70..a6fc2f6 100644 Binary files a/data/stanreg_glm_2.rda and b/data/stanreg_glm_2.rda differ diff --git a/data/stanreg_lm_1.rda b/data/stanreg_lm_1.rda index bbe04b7..29d92af 100644 Binary files a/data/stanreg_lm_1.rda and b/data/stanreg_lm_1.rda differ diff --git a/data/stanreg_lm_2.rda b/data/stanreg_lm_2.rda index a3ecd4f..1243dfa 100644 Binary files a/data/stanreg_lm_2.rda and b/data/stanreg_lm_2.rda differ diff --git a/data/stanreg_lm_3.rda b/data/stanreg_lm_3.rda index 29c99fa..e7cf6da 100644 Binary files a/data/stanreg_lm_3.rda and b/data/stanreg_lm_3.rda differ diff --git a/data/stanreg_lm_4.rda b/data/stanreg_lm_4.rda new file mode 100644 index 0000000..42c7ed4 Binary files /dev/null and b/data/stanreg_lm_4.rda differ diff --git a/data/stanreg_lm_5.rda b/data/stanreg_lm_5.rda new file mode 100644 index 0000000..a8570d1 Binary files /dev/null and b/data/stanreg_lm_5.rda differ diff --git a/data/stanreg_lm_6.rda b/data/stanreg_lm_6.rda new file mode 100644 index 0000000..910a17b Binary files /dev/null and b/data/stanreg_lm_6.rda differ diff --git a/data/stanreg_lm_7.rda b/data/stanreg_lm_7.rda new file mode 100644 index 0000000..a531022 Binary files /dev/null and b/data/stanreg_lm_7.rda differ diff --git a/data/stanreg_lmerMod_1.rda b/data/stanreg_lmerMod_1.rda index e7138a1..3acd881 100644 Binary files a/data/stanreg_lmerMod_1.rda and b/data/stanreg_lmerMod_1.rda differ diff --git a/data/stanreg_merMod_1.rda b/data/stanreg_merMod_1.rda index f3d7944..acc8877 100644 Binary files a/data/stanreg_merMod_1.rda and b/data/stanreg_merMod_1.rda differ diff --git a/data/stanreg_merMod_2.rda b/data/stanreg_merMod_2.rda index 04fe7dd..8cbcd5e 100644 Binary files a/data/stanreg_merMod_2.rda and b/data/stanreg_merMod_2.rda differ diff --git a/man/stanreg_lm_4.Rd b/man/stanreg_lm_4.Rd new file mode 100644 index 0000000..98eb4f5 --- /dev/null +++ b/man/stanreg_lm_4.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{stanreg_lm_4} +\alias{stanreg_lm_4} +\title{stanreg_lm_4} +\format{An object of class \code{stanreg} (inherits from \code{glm}, \code{lm}) of length 27.} +\usage{ +stanreg_lm_4 +} +\description{ +Model of class stanreg +} +\keyword{datasets} diff --git a/man/stanreg_lm_5.Rd b/man/stanreg_lm_5.Rd new file mode 100644 index 0000000..888d3ad --- /dev/null +++ b/man/stanreg_lm_5.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{stanreg_lm_5} +\alias{stanreg_lm_5} +\title{stanreg_lm_5} +\format{An object of class \code{stanreg} (inherits from \code{glm}, \code{lm}) of length 27.} +\usage{ +stanreg_lm_5 +} +\description{ +Model of class stanreg +} +\keyword{datasets} diff --git a/man/stanreg_lm_6.Rd b/man/stanreg_lm_6.Rd new file mode 100644 index 0000000..71852fc --- /dev/null +++ b/man/stanreg_lm_6.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{stanreg_lm_6} +\alias{stanreg_lm_6} +\title{stanreg_lm_6} +\format{An object of class \code{stanreg} (inherits from \code{glm}, \code{lm}) of length 27.} +\usage{ +stanreg_lm_6 +} +\description{ +Model of class stanreg +} +\keyword{datasets} diff --git a/man/stanreg_lm_7.Rd b/man/stanreg_lm_7.Rd new file mode 100644 index 0000000..f71cd1c --- /dev/null +++ b/man/stanreg_lm_7.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{stanreg_lm_7} +\alias{stanreg_lm_7} +\title{stanreg_lm_7} +\format{An object of class \code{stanreg} (inherits from \code{glm}, \code{lm}) of length 27.} +\usage{ +stanreg_lm_7 +} +\description{ +Model of class stanreg +} +\keyword{datasets}