Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/car #322

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
33ea96b
adding stan_CARbym; print/summary methods work
imadmali Jul 10, 2017
6feee4f
get important post-estimation methods/functions working
imadmali Jul 11, 2017
6ad17ba
adding stan_bym (inla version)
imadmali Jul 13, 2017
c2e2212
adding stan_besag (icar)
imadmali Jul 13, 2017
5b3fda8
fixing conditional in stanreg for car models
imadmali Jul 13, 2017
55fb6c6
expanding prior options for CAR models
imadmali Jul 21, 2017
6247da9
changes to spatial.fit file
imadmali Jul 25, 2017
f6f853d
Merge branch 'master' into feature/car
imadmali Aug 4, 2017
e3ea475
adding linkinv chunks to spatial.stan
imadmali Aug 4, 2017
4c0f42d
using chunk functions for meanPPD
imadmali Aug 4, 2017
2070bb4
demeaning, QR decom, and posterior methods work
imadmali Aug 6, 2017
fcc8d71
get prior summary working for CAR models
imadmali Aug 7, 2017
34f03e6
adding documentation for CAR models
imadmali Aug 7, 2017
1869c9c
adding stan_besag tests; CAR models return 'terms'
imadmali Aug 7, 2017
44f7e4a
adding vb methods for CAR models; optimizing currently fails
imadmali Aug 8, 2017
8746893
adding tests for stan_bym
imadmali Aug 8, 2017
c329a6a
use sparse matrix ops for 'scaling_factor'
imadmali Aug 8, 2017
0ebd45c
adding light documentation for stan_spatial.fit
imadmali Aug 8, 2017
9859ddb
omit optimizing from supported algorithms in CAR models
imadmali Aug 8, 2017
7c36fef
use chunks stan code; use prior_aux
imadmali Aug 9, 2017
fbdeeeb
adding more likelihoods to CAR models
imadmali Aug 9, 2017
11c132e
refactor stan chunks for spatial.stan
imadmali Aug 10, 2017
aeb898b
draft of CAR vignette; fixing binomial lpmf bug in spatial.stan
imadmali Aug 11, 2017
81cf7f6
updating documentation/vignette for CAR models
imadmali Aug 13, 2017
b65253c
adding 2nd order spatial random walks
imadmali Aug 13, 2017
a039e2a
Q should be squared if 'order == 2'
imadmali Aug 13, 2017
40b248b
update stan_besag tests with inla comparisons
imadmali Aug 13, 2017
b846069
changing stan_bym to stan_bym2 (INLA convention)
imadmali Aug 13, 2017
9aafe0b
adding BYM model; changing spatial parameter names
imadmali Aug 14, 2017
3582ca6
change parameterization in spatial.stan from prec to sd
imadmali Aug 14, 2017
9cc2a37
convert spatial weight matrix to sparse if necessary
imadmali Aug 14, 2017
87ec6a9
prior must be on theta_raw when model_type = 2
imadmali Aug 15, 2017
4ea4674
remove INLA dependency for bym2 model
imadmali Aug 30, 2017
41555ff
updating CAR spatial tests
imadmali Aug 30, 2017
31e8d1c
update CAR vignette
imadmali Aug 30, 2017
c3a55d0
changing names for spatial priors
imadmali Aug 31, 2017
2a9001a
updates to besag unit tests
imadmali Jan 12, 2018
557179b
fixing conflicts in feature/car
imadmali Jan 12, 2018
ee55e48
getting spatial models to compile
imadmali Jan 21, 2018
2da6c77
get posterior predict to work with CAR models (hacky)
imadmali Jan 22, 2018
7ab7a9a
updating spatial docs
imadmali Jan 30, 2018
a641852
return error when using loo on CAR models (tentative)
imadmali Sep 5, 2018
5a1173e
drop loo tests
imadmali Sep 5, 2018
a12bb9a
resolving merge conflicts in feature/car
imadmali Sep 6, 2018
4824fd3
modified namespace
imadmali Sep 7, 2018
02aa765
Merge branch 'master' into feature/car
imadmali Sep 7, 2018
3f52c0c
spatial.Rmd: fix encoding
bgoodri Sep 7, 2018
2876ac3
update from master
imadmali Sep 7, 2018
a129012
Merge branch 'master' into feature/car
imadmali Sep 7, 2018
b498fc0
making CAR family func consistent with other stan models
imadmali Sep 9, 2018
19a809d
fixing awkward family/link pairs; neg_bin(link=identity) still broken
imadmali Sep 10, 2018
a564548
fix count family/link issues in spatial.stan
imadmali Sep 12, 2018
8fe3ffd
cleanup loo
imadmali Oct 21, 2018
1556945
revise CAR tests
imadmali Oct 22, 2018
4ab4d1f
use sparseMatrix when dealing with CAR adjacency matrix
imadmali Oct 22, 2018
9b5bedc
simplify spatial tests
imadmali Oct 22, 2018
e65b2c7
fixing unit tests
imadmali Oct 23, 2018
04fc47a
Merge branch 'master' into feature/car
imadmali Oct 23, 2018
abd0a72
adding is_car instead of is(object, 'car')
imadmali Oct 23, 2018
557958c
revising spatial model vignette
imadmali Oct 28, 2018
05eed19
delete src/include
bgoodri Oct 28, 2018
6efcfe4
rm src/Modules*
bgoodri Oct 28, 2018
9eddcc2
dropping INLA requirement
imadmali Oct 28, 2018
e0dfbcc
fix family/link bounds in spatial.stan
imadmali Oct 28, 2018
ba88f97
Merge branch 'feature/car' of https://github.com/stan-dev/rstanarm in…
bgoodri Oct 28, 2018
5b08936
refactoring in-line declarations and likelihood contributions
imadmali Oct 28, 2018
8eb3c7f
NAMESPACE: update
bgoodri Oct 28, 2018
b3d968b
Merge branch 'feature/car' of https://github.com/stan-dev/rstanarm in…
bgoodri Oct 28, 2018
c809d14
Merge branch 'master' into feature/car
bgoodri Jul 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ Encoding: UTF-8
Authors@R: c(person("Jonah", "Gabry", email = "[email protected]", role = "aut"),
person("Imad", "Ali", role = "ctb"),
person("Sam", "Brilleman", role = "ctb"),
person(given = "Jacqueline Buros", family = "Novik",
person(given = "Jacqueline Buros", family = "Novik",
role = "ctb", comment = "R/stan_jm.R"),
person("AstraZeneca", role = "ctb", comment = "R/stan_jm.R"),
person("Trustees of", "Columbia University", role = "cph"),
person("Simon", "Wood", role = "cph", comment = "R/stan_gamm4.R"),
person("R Core", "Deveopment Team", role = "cph",
person("R Core", "Deveopment Team", role = "cph",
comment = "R/stan_aov.R"),
person("Douglas", "Bates", role = "cph", comment = "R/pp_data.R"),
person("Martin", "Maechler", role = "cph", comment = "R/pp_data.R"),
person("Ben", "Bolker", role = "cph", comment = "R/pp_data.R"),
person("Steve", "Walker", role = "cph", comment = "R/pp_data.R"),
person("Brian", "Ripley", role = "cph",
person("Brian", "Ripley", role = "cph",
comment = "R/stan_aov.R, R/stan_polr.R"),
person("William", "Venables", role = "cph", comment = "R/stan_polr.R"),
person("Paul-Christian", "Burkner", email = "[email protected]",
role = "cph", comment = "R/misc.R"),
person("Ben", "Goodrich", email = "[email protected]",
person("Ben", "Goodrich", email = "[email protected]",
role = c("cre", "aut")))
Description: Estimates previously compiled regression models using the 'rstan'
package, which provides the R interface to the Stan C++ library for Bayesian
Expand Down Expand Up @@ -54,6 +54,7 @@ Suggests:
digest,
gridExtra,
HSAUR3,
INLA,
knitr (>= 1.15.1),
MASS,
mgcv (>= 1.8-13),
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ S3method(update,stanmvreg)
S3method(update,stanreg)
S3method(vcov,stanreg)
S3method(waic,stanreg)
export()
export(R2)
export(Surv)
export(VarCorr)
export(bayes_R2)
export(beta)
export(cauchy)
export(compare_models)
export(decov)
Expand Down Expand Up @@ -148,6 +150,7 @@ export(ranef)
export(se)
export(sigma)
export(stan_aov)
export(stan_besag)
export(stan_betareg)
export(stan_betareg.fit)
export(stan_biglm)
Expand All @@ -168,6 +171,7 @@ export(stan_mvmer)
export(stan_nlmer)
export(stan_polr)
export(stan_polr.fit)
export(stan_spatial.fit)
export(stanjm_list)
export(stanmvreg_list)
export(stanreg_list)
Expand Down
103 changes: 61 additions & 42 deletions R/doc-datasets.R
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Part of the rstanarm package for estimating model parameters
# Copyright (C) 2015, 2016, 2017 Trustees of Columbia University
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#' Datasets for rstanarm examples
#'
#'
#' Small datasets for use in \pkg{rstanarm} examples and vignettes.
#'
#' @name rstanarm-datasets
#' @aliases kidiq roaches wells bball1970 bball2006 mortality tumors radon pbcLong pbcSurv
#' @format
#' @format
#' \describe{
#' \item{\code{bball1970}}{
#' Data on hits and at-bats from the 1970 Major League Baseball season for 18
#' players.
#'
#'
#' Source: Efron and Morris (1975).
#'
#'
#' 18 obs. of 5 variables
#' \itemize{
#' \item \code{Player} Player's last name
Expand All @@ -41,21 +41,21 @@
#' \item{\code{bball2006}}{
#' Hits and at-bats for the entire 2006 American League season of Major League
#' Baseball.
#'
#'
#' Source: Carpenter (2009)
#'
#'
#' 302 obs. of 2 variables
#' \itemize{
#' \item \code{y} Number of hits
#' \item \code{K} Number of at-bats
#' }
#' }
#' \item{\code{kidiq}}{
#' Data from a survey of adult American women and their children
#' Data from a survey of adult American women and their children
#' (a subsample from the National Longitudinal Survey of Youth).
#'
#'
#' Source: Gelman and Hill (2007)
#'
#'
#' 434 obs. of 4 variables
#' \itemize{
#' \item \code{kid_score} Child's IQ score
Expand All @@ -67,7 +67,7 @@
#' \item{\code{mortality}}{
#' Surgical mortality rates in 12 hospitals performing cardiac surgery
#' in babies.
#'
#'
#' Source: Spiegelhalter et al. (1996).
#'
#' 12 obs. of 2 variables
Expand All @@ -77,38 +77,38 @@
#' }
#' }
#' \item{\code{pbcLong,pbcSurv}}{
#' Longitudinal biomarker and time-to-event survival data for 40 patients
#' with primary biliary cirrhosis who participated in a randomised
#' Longitudinal biomarker and time-to-event survival data for 40 patients
#' with primary biliary cirrhosis who participated in a randomised
#' placebo controlled trial of D-penicillamine conducted at the Mayo
#' Clinic between 1974 and 1984.
#'
#'
#' Source: Therneau and Grambsch (2000)
#'
#'
#' 304 obs. of 8 variables (\code{pbcLong}) and 40 obs. of 7 variables (\code{pbcSurv})
#' \itemize{
#' \item \code{age} {in years}
#' \item \code{albumin} {serum albumin (g/dl)}
#' \item \code{logBili} {logarithm of serum bilirubin}
#' \item \code{death} {indicator of death at endpoint}
#' \item \code{futimeYears} {time (in years) between baseline and
#' \item \code{death} {indicator of death at endpoint}
#' \item \code{futimeYears} {time (in years) between baseline and
#' the earliest of death, transplantion or censoring}
#' \item \code{id} {numeric ID unique to each individual}
#' \item \code{platelet} {platelet count}
#' \item \code{sex} {gender (m = male, f = female)}
#' \item \code{status} {status at endpoint (0 = censored,
#' \item \code{status} {status at endpoint (0 = censored,
#' 1 = transplant, 2 = dead)}
#' \item \code{trt} {binary treatment code (0 = placebo, 1 =
#' \item \code{trt} {binary treatment code (0 = placebo, 1 =
#' D-penicillamine)}
#' \item \code{year} {time (in years) of the longitudinal measurements,
#' taken as time since baseline)}
#' }
#' }
#'
#'
#' \item{\code{radon}}{
#' Data on radon levels in houses in the state of Minnesota.
#'
#' Data on radon levels in houses in the state of Minnesota.
#'
#' Source: Gelman and Hill (2007)
#'
#'
#' 919 obs. of 4 variables
#' \itemize{
#' \item \code{log_radon} Radon measurement from the house (log scale)
Expand All @@ -121,9 +121,9 @@
#' \item{\code{roaches}}{
#' Data on the efficacy of a pest management system at reducing the number of
#' roaches in urban apartments.
#'
#'
#' Source: Gelman and Hill (2007)
#'
#'
#' 262 obs. of 6 variables
#' \itemize{
#' \item \code{y} Number of roaches caught
Expand All @@ -136,10 +136,10 @@
#' \item{\code{tumors}}{
#' Tarone (1982) provides a data set of tumor incidence in historical
#' control groups of rats; specifically endometrial stromal polyps in
#' female lab rats of type F344.
#'
#' female lab rats of type F344.
#'
#' Source: Gelman and Hill (2007)
#'
#'
#' 71 obs. of 2 variables
#' \itemize{
#' \item \code{y} Number of rats with tumors
Expand All @@ -153,9 +153,9 @@
#' safe public or private well in the nearby area and the survey was conducted
#' several years later to learn which of the affected residents had switched
#' wells.
#'
#'
#' Souce: Gelman and Hill (2007)
#'
#'
#' 3020 obs. of 5 variables
#' \itemize{
#' \item \code{switch} Indicator for well-switching
Expand All @@ -167,27 +167,46 @@
#' \item \code{educ} Years of education (head of household)
#' }
#' }
#' \item{\code{lattice}}{ The \code{grid_sim15} and \code{grid_sim30}
#' SpatialPolygonsDataFrame objects are a simulated lattice of 225 and 900
#' spatial units, respectively. These objects contain spatially dependent
#' observations simulated as a Gaussian Markov Random Field (GMRF). The data
#' slot in \code{grid_sim15} contains simulated outcomes using the GMRF and
#' various supported likelihoods.
#'
#' Source: Simulated data
#'
#' \itemize{
#' \item \code{gmrf} GMRF data simulated using Cholesky decomposition sampling
#' from the precision form of the Multivariate Normal distribution centered at
#' zero.
#' \item \code{r} X-position of a location on the grid (origin is at the
#' bottom-left).
#' \item \code{c} Y-position of a location on the grid (origin is at the
#' bottom-left).
#' }
#'
#' @references
#' }
#' }
#'
#' @references
#' Carpenter, B. (2009) Bayesian estimators for the beta-binomial model of
#' batting ability. \url{http://lingpipe-blog.com/2009/09/23/}
#'
#'
#' Efron, B. and Morris, C. (1975) Data analysis using Stein's estimator and its
#' generalizations. \emph{Journal of the American Statistical Association}
#' \strong{70}(350), 311--319.
#'
#'
#' @templateVar armRef \url{http://stat.columbia.edu/~gelman/arm/}
#' @template reference-gelman-hill
#'
#'
#' @references
#' Spiegelhalter, D., Thomas, A., Best, N., & Gilks, W. (1996) BUGS 0.5
#' Spiegelhalter, D., Thomas, A., Best, N., & Gilks, W. (1996) BUGS 0.5
#' Examples. MRC Biostatistics Unit, Institute of Public health, Cambridge, UK.
#'
#'
#' Tarone, R. E. (1982) The use of historical control information in testing for
#' a trend in proportions. \emph{Biometrics} \strong{38}(1):215--220.
#'
#' Therneau, T. and Grambsch, P. (2000) \emph{Modeling Survival Data: Extending
#'
#' Therneau, T. and Grambsch, P. (2000) \emph{Modeling Survival Data: Extending
#' the Cox Model}. Springer-Verlag, New York, US.
#'
#' @examples
Expand All @@ -200,7 +219,7 @@
#' pp_check(fit, nreps = 20)
#' \donttest{
#' bayesplot::color_scheme_set("brightblue")
#' pp_check(fit, plotfun = "stat_grouped", stat = "median",
#' pp_check(fit, plotfun = "stat_grouped", stat = "median",
#' group = factor(kidiq$mom_hs, labels = c("No HS", "HS")))
#' }
#' }
Expand Down
Loading