├── .DS_Store ├── README.md └── resources ├── .DS_Store ├── Speaker 1 - Edgar Santos-Fernandez ├── README.md └── Santos, Edgar space time presentation.pdf ├── Speaker 10 - Zachary Roman ├── README.md └── StanConZacharyRoman.pdf ├── Speaker 2 - Stan Yip ├── README.md └── stanconnect.pdf ├── Speaker 3 - Rafael Cabral ├── README.md ├── slides.pdf └── vignette │ ├── bib.bib │ ├── files │ ├── GaussSAR.exe │ ├── GaussSAR.stan │ ├── Gauss_fit.rds │ ├── NIGSAR.exe │ ├── NIGSAR.stan │ ├── NIG_columbus.rds │ ├── columbus.png │ ├── sim3.png │ ├── sim4.jpg │ └── utils.R │ ├── stanconnect.Rmd │ └── stanconnect.html ├── Speaker 4 - Pierfrancesco Alaimo Di Loro ├── Leroux.zip ├── README.md ├── STPoiAR_StanCon_PAlaimoDiLoro.pdf └── VignetteSparseLeroux.html ├── Speaker 5 - Sujit Sahu ├── README.md ├── olsks_stanconnect.pdf ├── sujitsahu_abstract.Rmd └── sujitsahu_abstract.html ├── Speaker 6 - Silvia De Nicolo ├── .DS_Store ├── README.md ├── slidesTipsae.pdf └── tipsae_package_vignette.pdf ├── Speaker 7 - Connor Donegan ├── Donegan.pdf └── README.md ├── Speaker 8 - Marco Gramatica ├── 2022_07_StanConnect_HANDOUT.pdf └── README.md └── Speaker 9 - Victoire Michel ├── README.md └── Slides_StanConnect_Victoire.pdf /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # StanConnect 2022: _Stan Through Space and Time_ 2 | 3 | 4 | Host: [__Jamie Hogg__](https://twitter.com/JamieAHogg) (Queensland University of Technology - Australia) 5 | 6 | Speakers: 7 | 8 | - [__Connor Donegan__](https://connordonegan.github.io) (University of Texas - USA) 9 | - [__Zachary J. Roman__](https://www.psychologie.uzh.ch/de/bereiche/ehem/quamet/team/roman-zack.html) (University of Zurich - Switzerland) 10 | - [__Silvia De Nicolò__](https://www.unibo.it/sitoweb/silvia.denicolo) (University of Bologna - Italy) 11 | - [__Sujit Sahu__](https://www.sujitsahu.com) (University of Southampton - UK) 12 | - [__Victoire Michal__](https://scholar.google.ca/citations?user=AG0dUp8AAAAJ&hl=fr) (McGill University - Canada) 13 | - [__Rafael Cabral__](https://cemse.kaust.edu.sa/stat/people/person/rafael-medeiros-cabral) (KAUST - Saudi Arabia) 14 | - [__Edgar Santos Fernandez__](https://acems.org.au/our-people/edgar-santos-fernandez) (Queensland University of Technology - Australia) 15 | - [__Marco Gramatica__](https://www.qmul.ac.uk/maths/profiles/gramaticam.html) (Queen Mary University of London - UK) 16 | - [__Stan Yip__](https://scholar.google.com/citations?user=eFWvpdAAAAAJ&hl=en) (The Hong Kong Polytechnic University - China) 17 | - [__Pierfrancesco Alaimo Di Loro__](https://scholar.google.com/citations?user=JG-jP6cAAAAJ&hl=en) (University of Southampton - UK, LUMSA University - Italy) 18 | -------------------------------------------------------------------------------- /resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/.DS_Store -------------------------------------------------------------------------------- /resources/Speaker 1 - Edgar Santos-Fernandez/README.md: -------------------------------------------------------------------------------- 1 | # Edgar Santos Fernandez 2 | 3 | Package: [SSNbayes](https://github.com/EdgarSantos-Fernandez/SSNbayes) 4 | 5 | Bio: Dr. Santos-Fernandez works on the development of statistical methodology across many domains such as ecology and conservation, citizen science, risk assessment and sports analytics. This includes advancing sampling techniques, spatio-temporal modelling, multivariate statistics, and anomaly detection. 6 | He is currently working on spatio-temporal applications in river networks. 7 | More details and recent publications can be found [here](https://www.researchgate.net/profile/Edgar-Santos-Fernandez) 8 | -------------------------------------------------------------------------------- /resources/Speaker 1 - Edgar Santos-Fernandez/Santos, Edgar space time presentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 1 - Edgar Santos-Fernandez/Santos, Edgar space time presentation.pdf -------------------------------------------------------------------------------- /resources/Speaker 10 - Zachary Roman/README.md: -------------------------------------------------------------------------------- 1 | # Zachary Roman 2 | 3 | Bio: Dr. Zachary Roman is a postdoctoral researcher in the psychology department at the University of Zurich, he is also affiliated with the Method Center at the University of Tuebingen. Zachary completed his Ph.D. in quantitative psychology at the University of Kansas in 2019. His research interests include the applications of spatial / social network autoregressive approaches in the behavioral sciences, specifically focused on methodological developments in this area. 4 | -------------------------------------------------------------------------------- /resources/Speaker 10 - Zachary Roman/StanConZacharyRoman.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 10 - Zachary Roman/StanConZacharyRoman.pdf -------------------------------------------------------------------------------- /resources/Speaker 2 - Stan Yip/README.md: -------------------------------------------------------------------------------- 1 | # Stan Yip 2 | 3 | Bio: Dr Yip is a researcher in various areas in statistical applications primarily environmental sciences and climatology. Prior to his role in the Hong Kong Polytechnic University, he has spent a few years in multiple R&D roles in industry before returning to academia. He was a research scientist in National Centre for Atmospheric Science, a research associate in University of Exeter, a junior member of Isaac Newton Institute for Mathematical Sciences in Cambridge and a visiting scholar in Duke University. 4 | 5 | Code can be found [here](https://github.com/stanyip/mosquitoe) -------------------------------------------------------------------------------- /resources/Speaker 2 - Stan Yip/stanconnect.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 2 - Stan Yip/stanconnect.pdf -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/README.md: -------------------------------------------------------------------------------- 1 | # Rafael Cabral 2 | 3 | Title: Robust non-Gaussian models and how to fit them in Stan 4 | 5 | Bookdown: [Fitting robust non-Gaussian models in Stan](https://rafaelcabral96.github.io/nigstan/) 6 | 7 | Vignette: [Fitting robust non-Gaussian models in Stan](https://rawcdn.githack.com/stan-dev/connect22-space-time/9861468cbfcec939c25c88c81693b5055134e7a6/resources/Speaker%203%20-%20Rafael%20Cabral/vignette/stanconnect.html) 8 | 9 | Paper: [Controlling the flexibility of non-Gaussian processes through shrinkage priors](https://arxiv.org/abs/2203.05510) 10 | 11 | Bio: My name is Rafael and I am PhD candidate at KAUST, Saudi Arabia, being supervised by Profs. Haavard Rue, and David Bolin. My PhD research revolves around building more flexible, robust, and computationally efficient modeling frameworks for spatial and temporal data. I’ve worked with Gaussian and non-Gaussian processes, model criticism and robustness, and approximate inference with Stan, INLA, and variational inference. Currently looking for a postdoc position. -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/slides.pdf -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/bib.bib: -------------------------------------------------------------------------------- 1 | 2 | 3 | @article{west1984outlier, 4 | title={Outlier models and prior distributions in Bayesian linear regression}, 5 | author={West, Mike}, 6 | journal={Journal of the Royal Statistical Society: Series B (Methodological)}, 7 | volume={46}, 8 | number={3}, 9 | pages={431--439}, 10 | year={1984}, 11 | publisher={Wiley Online Library} 12 | } 13 | 14 | @article{walder2020bayesian, 15 | title={Bayesian analysis of spatial generalized linear mixed models with Laplace moving average random fields}, 16 | author={Walder, Adam and Hanks, Ephraim M}, 17 | journal={Computational Statistics \& Data Analysis}, 18 | volume={144}, 19 | pages={106861}, 20 | year={2020}, 21 | publisher={Elsevier} 22 | } 23 | 24 | @article{NIGAR, 25 | title={{Normal inverse Gaussian autoregressive model using EM algorithm}}, 26 | author={Dhull, Monika S. and Kumar, Arun}, 27 | journal={International Journal of Advances in Engineering Sciences and Applied Mathematics}, 28 | year={2021} 29 | } 30 | 31 | @article{ghasami2020autoregressive, 32 | title={Autoregressive processes with generalized hyperbolic innovations}, 33 | author={Ghasami, Safdar and Khodadadi, Zahra and Maleki, Mohsen}, 34 | journal={Communications in Statistics-Simulation and Computation}, 35 | volume={49}, 36 | number={12}, 37 | pages={3080--3092}, 38 | year={2020}, 39 | publisher={Taylor \& Francis} 40 | } 41 | 42 | @article{wallin2015geostatistical, 43 | title={Geostatistical modelling using non-Gaussian Mat{\'e}rn fields}, 44 | author={Wallin, Jonas and Bolin, David}, 45 | journal={Scandinavian Journal of Statistics}, 46 | volume={42}, 47 | number={3}, 48 | pages={872--890}, 49 | year={2015}, 50 | publisher={Wiley Online Library} 51 | } 52 | -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/GaussSAR.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/vignette/files/GaussSAR.exe -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/GaussSAR.stan: -------------------------------------------------------------------------------- 1 | data{ 2 | int N; // Number of observations 3 | int N_covariates; // Number of covariates 4 | vector[N] y; // Observations 5 | matrix[N,N] W; // Adjacency matrix 6 | matrix[N,N_covariates] B; // Design matrix 7 | } 8 | 9 | parameters{ 10 | real sigma; // Standard deviation of NIG noise 11 | real rho; // Spatial range parameter 12 | vector[N_covariates] beta; // Regression coefficients 13 | } 14 | 15 | transformed parameters{ 16 | vector[N] x = (y - B*beta)/sigma; // Spatial effects 17 | } 18 | 19 | model{ 20 | matrix[N,N] D = add_diag(-rho*W, 1); // D = I - rho W; 21 | x ~ multi_normal_prec(rep_vector(0,N), D'*D); 22 | 23 | //prior layer--------------------------------- 24 | //prior for intercept 25 | beta[1] ~ normal(0.0, 1000); 26 | //prior for regression coefficients 27 | beta[2] ~ normal(0.0, 10); 28 | beta[3] ~ normal(0.0, 10); 29 | //prior for kappa 30 | rho ~ uniform(0,1); 31 | //prior for sigma 32 | sigma ~ normal(0,5); 33 | 34 | } 35 | 36 | generated quantities { 37 | vector[N] y_fit = B*beta + sigma*x; 38 | } 39 | 40 | 41 | -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/Gauss_fit.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/vignette/files/Gauss_fit.rds -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/NIGSAR.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/vignette/files/NIGSAR.exe -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/NIGSAR.stan: -------------------------------------------------------------------------------- 1 | functions { 2 | 3 | /** 4 | * Returns the log-likelihood of the NIG distribution with variance 5 | * correction at x (Var[x] = sigma^2*h) 6 | * 7 | * @param x 8 | * @param sigma Standard deviation 9 | * @param eta First flexibility parameter (controls heaviness of tails) 10 | * @param zeta Second flexibility parameter (controls asymmetry of tails) 11 | * @param h Distance between locations or area of the basis function 12 | * @return Log-likelihood of the NIG distribution with variance correction 13 | */ 14 | real NIG_var_correction_lpdf(real x, real eta, real zeta, real h){ 15 | real sigmas = 1/sqrt(1+zeta^2*eta); //variance correction 16 | real hyp_alpha = sqrt(1/eta+zeta^2)/sigmas; 17 | real hyp_beta = zeta/sigmas; 18 | real hyp_delta = sigmas*sqrt(1/eta)*h; 19 | real hyp_mu = -sigmas*zeta*h; 20 | return (sqrt(hyp_alpha^2 - hyp_beta^2)*hyp_delta + hyp_beta*(x - hyp_mu) + log(hyp_alpha) + 21 | log(hyp_delta) - log(pi()) - 0.5*log(hyp_delta^2 + (x - hyp_mu)^2) + 22 | log(modified_bessel_second_kind(1, hyp_alpha*sqrt(hyp_delta^2 + (x - hyp_mu)^2)))); 23 | } 24 | 25 | 26 | /** 27 | * Returns the partial sums (the log-likelihood terms from 'start' to 'end' (inclusive) ) 28 | * of the log-likelihood of the vector X defined by DX=Lambda, where D is a matrix and Lambda 29 | * is independent NIG noise: log dens_X(x) = log determinant(D) + sum_{i=1}^N log dens_NIG([Dx]_i). 30 | * This partial sum function is the first argument of the reduce_sum() function which 31 | * automatically chooses partial sums partitioning based on a dynamic scheduling algorithm, 32 | * allowing for within-chain parallelization 33 | * 34 | * @param slice_Dx The subset of DX for which this partial sum is responsible (slice_DX = DX[start:end]) 35 | * @param start First term in the partial sum 36 | * @param end Last term in the partial sum (inclusive) 37 | * @param sigma Standard deviation 38 | * @param eta First flexibility parameter (controls heaviness of tails) 39 | * @param zeta Second flexibility parameter (controls asymmetry of tails) 40 | * @param h Vector containing the distance between locations or area of the basis functions 41 | * @return Returns the partial sum of the log likelihood of X from start to end 42 | */ 43 | real partial_sum_lpdf(real[] slice_DX, int start, int end, real eta, real zeta, vector h){ 44 | int N = end - start + 1; 45 | real llik_partial; 46 | vector[N] ll; 47 | for(i in 1:N){ 48 | ll[i] = NIG_var_correction_lpdf( slice_DX[i] | eta, zeta, h[start + i - 1]);} 49 | llik_partial = sum(ll); 50 | return llik_partial; 51 | } 52 | 53 | /** 54 | * Returns the log-likelihood of X where DX=Lambda, D is a matrix and 55 | * Lambda is a vector of independent NIG noise. 56 | * 57 | * @param X 58 | * @param D Matrix D 59 | * @param Dv Array of integer column indices for the non-zero values in D 60 | * @param Du Array of integer indices indicating where a given row’s values start 61 | * @param sizes Array of integers containing the number of rows, collums and number non-zero elements of D 62 | * @param sigma Standard deviation 63 | * @param etas First flexibility parameter (controls heaviness of tails) 64 | * @param mus Second flexibility parameter (controls asymmetry of tails) 65 | * @param h Vector containing the distance between locations or area of the basis functions 66 | * @param compute_det Compute the log determinant of D if D depends on parameter (compute_det=1). Otherwise set compute_det=0. 67 | * @return Log-likelihood of X 68 | */ 69 | real nig_model_lpdf(vector X, matrix D, real etas, real zetas, vector h, int compute_det){ 70 | 71 | //convert tail correction parameters (etas, zetas) to original parameterization (eta, zeta) 72 | real eta = etas*(1+zetas^2-fabs(zetas)*sqrt(1+zetas^2))^2; 73 | real zeta = zetas/sqrt(eta); 74 | 75 | //log-likelihood of the random vector X 76 | real llik_total = reduce_sum(partial_sum_lpdf, to_array_1d(D*X), 1, eta, zeta, h); 77 | 78 | //If D depends on parameter add log determinant 79 | if(compute_det==1){ 80 | llik_total += sum(log(diagonal(cholesky_decompose(D'*D)))); //Only works for spd precision matrices!!! 81 | } 82 | 83 | return(llik_total); 84 | } 85 | 86 | } 87 | 88 | data{ 89 | int N; // Number of observations 90 | int N_covariates; // Number of covariates 91 | vector[N] y; // Observations 92 | matrix[N,N] W; // Adjacency matrix 93 | matrix[N,N_covariates] B; // Design matrix 94 | 95 | real thetaetas; // Rate constant for PC prior of nus 96 | real thetazetas; // Rate constant for PC prior of zetas 97 | } 98 | 99 | transformed data{ 100 | vector[N] h = rep_vector(1,N); // In this problem h is a vector of ones 101 | } 102 | 103 | parameters{ 104 | real sigma; // Standard deviation of NIG noise 105 | real rho; // Spatial range parameter 106 | real etas; // First flexibility parameter (controls heaviness of tails) 107 | real zetas; // Second flexibility parameter (controls asymmetry of tails) 108 | vector[N_covariates] beta; // Regression coefficients 109 | } 110 | 111 | transformed parameters{ 112 | vector[N] x = (y - B*beta)/sigma; // Spatial effects 113 | } 114 | 115 | model{ 116 | 117 | matrix[N,N] D = add_diag(-rho*W, 1); 118 | x ~ nig_model(D, etas, zetas, h, 1); 119 | 120 | //prior layer--------------------------------- 121 | //prior for intercept 122 | beta[1] ~ normal(0.0, 1000); 123 | //prior for regression coefficients 124 | beta[2] ~ normal(0.0, 10); 125 | beta[3] ~ normal(0.0, 10); 126 | //prior for kappa 127 | rho ~ uniform(0,1); 128 | //prior for sigma 129 | sigma ~ normal(0,5); 130 | //prior for etas 131 | target += -thetaetas*etas; 132 | //prior for zetas 133 | target += -thetazetas*fabs(zetas); 134 | 135 | } 136 | -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/NIG_columbus.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/vignette/files/NIG_columbus.rds -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/columbus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/vignette/files/columbus.png -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/sim3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/vignette/files/sim3.png -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/sim4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 3 - Rafael Cabral/vignette/files/sim4.jpg -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/files/utils.R: -------------------------------------------------------------------------------- 1 | library(GIGrvg) # Evaluate density of a GIG distribution 2 | 3 | VposteriorSAR <- function(X, rho, W, etas, zetas, h){ 4 | 5 | library(GIGrvg) 6 | n_draws <- nrow(X) 7 | 8 | eta = etas*(1+zetas^2-abs(zetas)*sqrt(1+zetas^2))^2 9 | zeta = zetas/sqrt(eta) 10 | sigmas = 1/sqrt(1+zetas^2) 11 | 12 | n <- ncol(X) 13 | DX <- matrix(NA, nrow = n_draws, ncol = n) 14 | for(i in 1:n_draws){ 15 | D <- diag(rep(1,n)) - rho[i]*W 16 | DX[i,] <- as.numeric(D%*%X[i,])} 17 | 18 | #V = matrix(NA, nrow= n_draws, ncol = n) 19 | #for(i in 1:n){ 20 | # V[,i] <- GIGrvg::rgig(n_draws, lambda= -1, psi = 1/eta+zeta^2, chi = h[i]^2/eta + (DX[,i]/sigmas + zeta*h[i])^2)} 21 | 22 | V = matrix(NA, nrow= n_draws, ncol = n) 23 | for(i in 1:n_draws){ 24 | for(j in 1:n){ 25 | V[i,j] <- GIGrvg::rgig(1, lambda= -1, psi = 1/eta[i]+zeta[i]^2, chi = h[j]^2/eta[i] + (DX[i,j] + zeta[i]*h[j])^2) 26 | } 27 | } 28 | 29 | return(V%*%diag(1/h)) 30 | } 31 | 32 | 33 | 34 | #Allow for decreasing plot legends. I do not like the default increasing scale of Leaflet 35 | #Taken from https://stackoverflow.com/questions/40276569/reverse-order-in-r-leaflet-continuous-legend 36 | addLegend_decreasing <- function (map, position = c("topright", "bottomright", "bottomleft","topleft"), 37 | pal, values, na.label = "NA", bins = 7, colors, 38 | opacity = 0.5, labels = NULL, labFormat = labelFormat(), 39 | title = NULL, className = "info legend", layerId = NULL, 40 | group = NULL, data = getMapData(map), decreasing = FALSE) { 41 | 42 | position <- match.arg(position) 43 | type <- "unknown" 44 | na.color <- NULL 45 | extra <- NULL 46 | if (!missing(pal)) { 47 | if (!missing(colors)) 48 | stop("You must provide either 'pal' or 'colors' (not both)") 49 | if (missing(title) && inherits(values, "formula")) 50 | title <- deparse(values[[2]]) 51 | values <- evalFormula(values, data) 52 | type <- attr(pal, "colorType", exact = TRUE) 53 | args <- attr(pal, "colorArgs", exact = TRUE) 54 | na.color <- args$na.color 55 | if (!is.null(na.color) && col2rgb(na.color, alpha = TRUE)[[4]] == 56 | 0) { 57 | na.color <- NULL 58 | } 59 | if (type != "numeric" && !missing(bins)) 60 | warning("'bins' is ignored because the palette type is not numeric") 61 | if (type == "numeric") { 62 | cuts <- if (length(bins) == 1) 63 | pretty(values, bins) 64 | else bins 65 | if (length(bins) > 2) 66 | if (!all(abs(diff(bins, differences = 2)) <= 67 | sqrt(.Machine$double.eps))) 68 | stop("The vector of breaks 'bins' must be equally spaced") 69 | n <- length(cuts) 70 | r <- range(values, na.rm = TRUE) 71 | cuts <- cuts[cuts >= r[1] & cuts <= r[2]] 72 | n <- length(cuts) 73 | p <- (cuts - r[1])/(r[2] - r[1]) 74 | extra <- list(p_1 = p[1], p_n = p[n]) 75 | p <- c("", paste0(100 * p, "%"), "") 76 | if (decreasing == TRUE){ 77 | colors <- pal(rev(c(r[1], cuts, r[2]))) 78 | labels <- rev(labFormat(type = "numeric", cuts)) 79 | }else{ 80 | colors <- pal(c(r[1], cuts, r[2])) 81 | labels <- rev(labFormat(type = "numeric", cuts)) 82 | } 83 | colors <- paste(colors, p, sep = " ", collapse = ", ") 84 | } 85 | else if (type == "bin") { 86 | cuts <- args$bins 87 | n <- length(cuts) 88 | mids <- (cuts[-1] + cuts[-n])/2 89 | if (decreasing == TRUE){ 90 | colors <- pal(rev(mids)) 91 | labels <- rev(labFormat(type = "bin", cuts)) 92 | }else{ 93 | colors <- pal(mids) 94 | labels <- labFormat(type = "bin", cuts) 95 | } 96 | } 97 | else if (type == "quantile") { 98 | p <- args$probs 99 | n <- length(p) 100 | cuts <- quantile(values, probs = p, na.rm = TRUE) 101 | mids <- quantile(values, probs = (p[-1] + p[-n])/2, na.rm = TRUE) 102 | if (decreasing == TRUE){ 103 | colors <- pal(rev(mids)) 104 | labels <- rev(labFormat(type = "quantile", cuts, p)) 105 | }else{ 106 | colors <- pal(mids) 107 | labels <- labFormat(type = "quantile", cuts, p) 108 | } 109 | } 110 | else if (type == "factor") { 111 | v <- sort(unique(na.omit(values))) 112 | colors <- pal(v) 113 | labels <- labFormat(type = "factor", v) 114 | if (decreasing == TRUE){ 115 | colors <- pal(rev(v)) 116 | labels <- rev(labFormat(type = "factor", v)) 117 | }else{ 118 | colors <- pal(v) 119 | labels <- labFormat(type = "factor", v) 120 | } 121 | } 122 | else stop("Palette function not supported") 123 | if (!any(is.na(values))) 124 | na.color <- NULL 125 | } 126 | else { 127 | if (length(colors) != length(labels)) 128 | stop("'colors' and 'labels' must be of the same length") 129 | } 130 | legend <- list(colors = I(unname(colors)), labels = I(unname(labels)), 131 | na_color = na.color, na_label = na.label, opacity = opacity, 132 | position = position, type = type, title = title, extra = extra, 133 | layerId = layerId, className = className, group = group) 134 | invokeMethod(map, data, "addLegend", legend) 135 | } 136 | 137 | -------------------------------------------------------------------------------- /resources/Speaker 3 - Rafael Cabral/vignette/stanconnect.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Fitting robust non-Gaussian models in Stan" 3 | author: "Rafael Cabral" 4 | date: "`r Sys.Date()`" 5 | 6 | abstract: | 7 | This vignette introduces a generic class of non-Gaussian models and a small code example illustrating how to use the suite of functions we developed to implement these models in Stan. The models have the same mean and covariance structure as Gaussian models but have more flexible sample path behaviors and skewed marginals with longer tails. 8 | output: 9 | prettydoc::html_pretty: 10 | theme: cayman 11 | highlight: github 12 | number_sections: TRUE 13 | toc: yes 14 | bibliography: bib.bib 15 | --- 16 | 17 | 27 | 28 | ```{r setup, include=FALSE} 29 | library(spdep) # Columbus dataset 30 | library(rgdal) # Read polygon data 31 | library(leaflet) # Interactive widgets 32 | library(leaflet.extras) # Fullscreen control for Leaflet widget 33 | library(cmdstanr) # CmdStan R interface 34 | library(posterior) # Process the output of cmdstanr sampling 35 | source("files/utils.R") # Several utility functions 36 | ``` 37 | 38 | 39 | 40 | This vignette was written based on the following resources: 41 | 42 | - Bookdown: [Fitting robust non-Gaussian models in Stan](rafaelcabral96.github.io/nigstan/) 43 | 44 | - Paper: [Controlling the flexibility of non-Gaussian processes through shrinkage priors](arxiv.org/abs/2203.05510) 45 | 46 | The Bookdown offers a theoretical background, explicates the $Stan$ implementation, and contains several code examples for time series, geostatistical and areal data applications. 47 | 48 | 49 | *** 50 | 51 | # What and Why 52 | 53 | 54 | ## Why go beyond Gaussian processes? 55 | 56 | - Relax the assumption of Gaussianity: Gaussian processes can over-smooth in the presence of local spikes (@walder2020bayesian) and sudden jumps in the data (@NIGAR) 57 | - Predictions: One can obtain more accurate predictions with smaller standard deviations if non-Gaussian features are present in the data, 58 | - Robustness: Accommodate possible outliers in the data, and reduce their impact on the inferences (@west1984outlier) 59 | 60 | ## What type of non-Gaussian models are you considering? 61 | 62 | If $\mathbf{x}^G$ follows a multivariate Gaussian with mean $\mathbf{0}$ and precision matrix $\mathbf{Q}= \mathbf{\mathbf{D}}^T\mathbf{D}$, it can be expressed through 63 | 64 | $$ 65 | \mathbf{D}\mathbf{x}^G\overset{d}{=} \mathbf{Z}, 66 | $$ 67 | where $\mathbf{Z}$ is a vector of i.i.d. standard Gaussian variables. The non-Gaussian extension for $\mathbf{x}^G$ consists in replacing the driving noise distribution: 68 | $$ 69 | \mathbf{D}\mathbf{x}\overset{d}{=} \mathbf{\Lambda}(\eta^\star,\zeta^\star), 70 | $$ 71 | where $\boldsymbol{\Lambda}$ is a vector of independent and standardized normal-inverse Gaussian (NIG) random variables that depend on the parameter $\eta^\star$ and $\zeta^\star$, which controls the leptokurtosis and skewness of the driving noise. 72 | 73 | ## Setup 74 | 75 | The Gaussian model can be declared in Stan as: 76 | 77 | ``` 78 | x ~ multi_normal_prec(rep_vector(0,N), D'*D) 79 | ``` 80 | 81 | The non-Gaussian model declaration is: 82 | ``` 83 | x ~ nig_model(D, etas, zetas, h, 1) 84 | ``` 85 | 86 | The argument `h` should be a vector of ones for discrete-space models. For models defined in continuous space, for instance, a continuous random walk of order 1, `h` contains the distance between locations. The last argument is an integer with value 1 if the log-determinant of $\mathbf{D}$ should be computed (if $\mathbf{D}$ depends on parameters), or 0 otherwise. 87 | 88 | The `nig_model` and other Stan functions can be found in `nigstan\files\functions.stan` on [github.com/rafaelcabral96/nigstan](github.com/rafaelcabral96/nigstan). The `nig_model` uses a collapsed representation of $\mathbf{x}$, and also has built-in within-chain parallelizations to improve speed. Other available functions are: 89 | 90 | - `nig_model_2`: Similar to `nig_model` but leverages on the sparsity of $\mathbf{D}$ using Stan’s built-in functions for sparse matrix operations 91 | - `nig_multi`: independent NIG model (useful for a non-centered parameterization) 92 | 93 | 94 | ## Why not just transform Gaussian processes? 95 | 96 | For non-Gaussian datasets, a common approach is to start with a Gaussian process and then apply a non-linear transformation, such as the logarithm or the square root. However, @wallin2015geostatistical showed that the mean and covariance function of the transformed process could change in non-intuitive ways. For the square root transformation, if the mean of the Gaussian process contains covariates, this will induce a non-stationary covariance function for the data. 97 | 98 | The non-Gaussian processes driven by NIG noise that we are considering allow modeling the 3 model components separately without confounding: the mean, the covariance structure, and the non-Gaussianity. Changing one component does not affect the others. 99 | 100 | 101 | ## What models fit into this framework? 102 | 103 | We list some models that can be extended to non-Gaussianity in this way: 104 | 105 | - i.i.d. random effects; 106 | - Random walk (RW) and autoregressive processes (@ghasami2020autoregressive) for time series 107 | - Simultaneous autoregressive (@walder2020bayesian) and conditional autoregressive processes for graphical models and areal data 108 | - Matérn processes (@wallin2015geostatistical), which can be used in a variety of applications, such as in geostatistics and spatial point processes 109 | - More generally, several stochastic processes driven by Gaussian white noise defined via stochastic partial differential equations (SPDEs) $\mathcal{D}X(t) = \mathcal{W}(t)$ can be extended to non-Gaussianity by replacing $\mathcal{W}(t)$ by a NIG white noise distribution. The finite element method can be used to approximate $X(t)$ to discrete space, leading to the system $\mathbf{D}\mathbf{x} = \mathbf{\Lambda}$. 110 | 111 | ## What sample paths do these models produce? 112 | 113 | The first row of the following figure shows Gaussian (left) and NIG (right) white noise processes. The rows below show several processes built from these driving noises, including RW1, RW2, Ornstein–Uhlenbeck (OU), and Matérn ($\alpha=2$) processes. Whenever the NIG noise takes an extreme value (for instance, near location 0.8), the CRW1 and OU processes will exhibit a distinct jump, and the RW2 and Matérn processes will exhibit a kink (discontinuity in the first derivative). 114 | 115 | ![Noise and sample paths of several models for $\eta=10^{-6}$ (left) and $\eta=1$ (right), for $\sigma=1$ and $\zeta=0$.](files/sim4.jpg) 116 | 117 | ![Sample paths of a Matérn model in 2D (smoothness parameter $\alpha=2$), driven by NIG noise for several values of $\eta^\star$.](files/sim3.png) 118 | 119 | *** 120 | 121 | # Example (Columbus dataset) 122 | 123 | The dataset consists of crime rates in thousands ($y_i$) in 49 counties of Columbus, Ohio, and can be found in the `spdep` R package. We will fit the following model: 124 | $$ 125 | \mathbf{y}_{i}= \beta_0 + \beta_1 \text{HV}_i + \beta_2 \text{HI}_i + \sigma\mathbf{x}_i, 126 | $$ 127 | where $\text{HV}_i$ and $\text{HI}_i$ are the average household value and household income for county $i$, $\mathbf{x}$ is a spatial effects SAR model. 128 | 129 | ```{r message=FALSE, warning=FALSE} 130 | data(columbus) 131 | data <- columbus[,c("CRIME","HOVAL","INC")] # data 132 | N <- nrow(data) # number of counties 133 | map <- readOGR(system.file("shapes/columbus.shp", package="spData")[1]) # shape file containing the polygons 134 | ``` 135 | In the next Leaflet widget, we show the crime rates and the two covariates. 136 | 137 | ```{r echo=FALSE} 138 | rownames(data) <- 1:N-1 139 | 140 | #Leaflet expects data to be specified in latitude and longitude using the WGS84 coordinate projection, so we transform mesh_map to this projection as follows 141 | proj4string(map) <- CRS("+proj=longlat +datum=WGS84") 142 | map <- spTransform(map,CRS("+proj=longlat +datum=WGS84 +no_defs")) 143 | map <- SpatialPolygonsDataFrame(map, data) 144 | 145 | pal_crime <- colorNumeric(palette = "YlOrRd", domain = map$CRIME) 146 | pal_hoval <- colorNumeric(palette = "YlOrRd", domain = map$HOVAL) 147 | pal_inc <- colorNumeric(palette = "YlOrRd", domain = map$INC) 148 | leaflet(map) %>% 149 | addPolygons( color = "grey", weight = 1, fillColor = ~ pal_crime(CRIME), fillOpacity = 0.6, group = "Crime") %>% 150 | addPolygons( color = "grey", weight = 1, fillColor = ~ pal_hoval(HOVAL), fillOpacity = 0.6, group = "House Value") %>% 151 | addPolygons( color = "grey", weight = 1, fillColor = ~ pal_inc(INC), fillOpacity = 0.6, group = "Income") %>% 152 | addLegend_decreasing(pal = pal_crime, values = ~CRIME,title = "Crime (in thousands)", 153 | position = "bottomright", decreasing = TRUE, group = "Crime") %>% 154 | addLegend_decreasing(pal = pal_hoval, values = ~HOVAL,title = "Average Household Value", 155 | position = "bottomright", decreasing = TRUE, group = "House Value") %>% 156 | addLegend_decreasing(pal = pal_inc, values = ~INC, title = "Average Household Income", 157 | position = "bottomright", decreasing = TRUE, group = "Income") %>% 158 | addLayersControl(overlayGroups = c("Crime", "House Value","Income"), 159 | options = layersControlOptions(collapsed = FALSE)) %>% 160 | hideGroup("House Value") %>% 161 | hideGroup("Income") %>% 162 | addFullscreenControl() 163 | ``` 164 | 165 | 166 | We consider a simultaneous autoregressive (SAR) model for the spatially structured effects $\mathbf{x}$. The Gaussian version of this model can be built from the following system $\mathbf{D}_{SAR}\mathbf{x} = \sigma\mathbf{Z}$, where $\mathbf{D}_{SAR}=\mathbf{I}-\rho\mathbf{W}$. The matrix $\mathbf{W}$ is the row standardized adjacency matrix and $-1<\rho<1$. The equivalent model driven by NIG noise is then $\mathbf{D}_{SAR}\mathbf{x} = \sigma\mathbf{\Lambda}$, where $\mathbf{\Lambda}$ is i.i.d. standardized NIG noise. 167 | 168 | We obtain next the adjacency matrix $\mathbf{W}$. 169 | 170 | ```{r} 171 | nb_q <- poly2nb(map) # Construct neighbours list from polygon list 172 | nb_W <- nb2listw(nb_q, style="B", zero.policy=TRUE) # Spatial weights for neighbours lists 173 | W <- as.matrix(as(nb_W, "sparseMatrix")) # Adjacency matrix W 174 | W <- diag(1/rowSums(W))%*%W # Row standardize adjacency matrix 175 | ``` 176 | 177 | We build the design matrix $\mathbf{B}$ and the list to be passed to Stan next: 178 | 179 | ```{r} 180 | B <- cbind(rep(1,N),data[,c(2,3)]) #Design matrix 181 | 182 | dat1 <- list(N = N, #Number of observations 183 | N_covariates = 3, #Number of covariates 184 | y = data$CRIME, #Observations 185 | B = B, #Design matrix 186 | W = W, #Row standardized adjacency matrix 187 | thetaetas = 1, #Rate parameter of the exponential prior for etas 188 | thetazetas = 2) #Rate parameter of the exponential prior for zetas 189 | ``` 190 | 191 | ## Gaussian fit 192 | 193 | An (inefficient) implementation of the Gaussian SAR model is: 194 | 195 | ```{} 196 | transformed parameters{ 197 | vector[N] x = (y - B*beta)/sigma; // Spatial effects 198 | } 199 | 200 | model{ 201 | matrix[N,N] D = add_diag(-rho*W, 1); // D = I - rho W; 202 | x ~ multi_normal_prec(rep_vector(0,N), D'*D); 203 | ... 204 | } 205 | ``` 206 | 207 | 208 | ```{r, eval = FALSE} 209 | model_stan_Gauss <- cmdstan_model('files/GaussSAR.stan') 210 | fit_Gauss <- model_stan_Gauss$sample(data = dat1, 211 | chains = 4, 212 | iter_warmup = 2000, 213 | iter_sampling = 3000) 214 | 215 | fit_Gauss$save_object("files/Gauss_fit.rds") 216 | fit_Gauss$cmdstan_diagnose() #No warnings 217 | ``` 218 | 219 | Let us look at the summary: 220 | 221 | ```{r} 222 | fit_Gauss <- readRDS("files/Gauss_fit.rds") 223 | knitr::kable(head(fit_Gauss$summary(),6), "simple", row.names = NA, digits=2) 224 | ``` 225 | 226 | 227 | ## NIG fit 228 | 229 | The SAR model driven with NIG noise can be declared in Stan by just changing one line of code of the Gaussian Stan model. 230 | 231 | ```{} 232 | transformed parameters{ 233 | vector[N] X = (y - B*beta)/sigma; // Spatial effects 234 | } 235 | 236 | model{ 237 | 238 | matrix[N,N] D = add_diag(-rho*W, 1); // D = I - rho W; 239 | X ~ nig_model(D, etas, zetas, h, 1); 240 | .,. 241 | ``` 242 | 243 | ```{r, eval = FALSE} 244 | model_stan_NIG <- cmdstan_model('files/NIGSAR.stan') 245 | fit_NIG <- model_stan_NIG$sample(data = dat1, 246 | chains = 4, 247 | iter_warmup = 2000, 248 | iter_sampling = 3000) 249 | 250 | fit_NIG$save_object("files/NIG_columbus.rds") 251 | fit_NIG$cmdstan_diagnose() #No warnings 252 | ``` 253 | 254 | The posterior distributions for the regression coefficients were similar, and the posterior distributions of $\eta^\star$ and $\zeta^\star$ suggest heavy-tailedness although no asymmetry. 255 | 256 | ```{r} 257 | fit_NIG <- readRDS("files/NIG_columbus.rds") 258 | knitr::kable(head(fit_NIG$summary(),8), "simple", row.names = NA, digits=2) 259 | ``` 260 | 261 | 262 | The NIG noise $\Lambda_i$ can be seen as a normal variance mixture. In the symmetric case, $\Lambda_i|V_i \sim N(0,V_i)$, where $V_i$ are inverse-Gaussian mixing variables. The posterior draws for $\mathbf{V} = [V_1,\dotsc,V_N]^T$ can be generated from the posterior draws of $\mathbf{x}$, $\eta^\star$, $\zeta^\star$ and $\rho$ as done next. We utilized the function `VposteriorSAR` located at `files/utils.R`. High values for $V_i$ indicate that region $i$ had a spike in the spatial effects that was not captured by the covariates, which are too large to be modeled by a Gaussian model. 263 | 264 | ```{r} 265 | X <- as.matrix(as_draws_df(fit_NIG$draws("x")))[,1:N] 266 | etas <- as.matrix(as_draws_df(fit_NIG$draws("etas")))[,1] 267 | zetas <- as.matrix(as_draws_df(fit_NIG$draws("zetas")))[,1] 268 | rho <- as.matrix(as_draws_df(fit_NIG$draws("rho")))[,1] 269 | h <- rep(1,N) 270 | 271 | V_post <- VposteriorSAR(X, rho, W, etas, zetas, h) 272 | ``` 273 | 274 | In the next leaflet widget, we show the posterior mean and standard deviation of the spatial effects as well as the posterior mean of $\mathbf{V}$. 275 | 276 | ```{r echo=FALSE} 277 | sigma <- as.matrix(as_draws_df(fit_NIG$draws("sigma")))[,1] 278 | sigmaX <- sigma*as.matrix(as_draws_df(fit_NIG$draws("x")))[,1:N] 279 | V <- colMeans(V_post) 280 | 281 | data$xmean <- colMeans(sigmaX) 282 | data$xsd <- apply(sigmaX,2,sd) 283 | data$V <- V 284 | 285 | rownames(data) <- 1:N-1 286 | map <- SpatialPolygonsDataFrame(map, data) 287 | pal_xmean <- colorNumeric(palette = c("blue","white","red"), domain = map$xmean) 288 | pal_xsd <- colorNumeric(palette = "YlOrRd", domain = map$xsd) 289 | pal_V <- colorNumeric(palette = "YlOrRd", domain = map$V) 290 | 291 | leaflet(map) %>% 292 | addPolygons( color = "grey", weight = 1, fillColor = ~ pal_xmean(xmean), fillOpacity = 0.6, group = "X mean") %>% 293 | addPolygons( color = "grey", weight = 1, fillColor = ~ pal_xsd(xsd) , fillOpacity = 0.6, group = "X sd" ) %>% 294 | addPolygons( color = "grey", weight = 1, fillColor = ~ pal_V(V) , fillOpacity = 0.6, group = "V mean") %>% 295 | addLegend_decreasing(pal = pal_xmean, values = ~xmean,title = "Mean of spatial effects", 296 | position = "bottomright", decreasing = TRUE, group = "X mean") %>% 297 | addLegend_decreasing(pal = pal_xsd, values = ~xsd, title = "SD of Spatial effects", 298 | position = "bottomright", decreasing = TRUE, group = "X sd") %>% 299 | addLegend_decreasing(pal = pal_V, values = ~V, title = "mean of V", 300 | position = "bottomright", decreasing = TRUE, group = "V mean") %>% 301 | addLayersControl(overlayGroups = c("X mean", "X sd","V mean"), 302 | options = layersControlOptions(collapsed = FALSE)) %>% 303 | hideGroup(c("X sd","V mean")) %>% 304 | addFullscreenControl() 305 | ``` 306 | 307 | *** 308 | 309 | # References 310 | -------------------------------------------------------------------------------- /resources/Speaker 4 - Pierfrancesco Alaimo Di Loro/Leroux.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 4 - Pierfrancesco Alaimo Di Loro/Leroux.zip -------------------------------------------------------------------------------- /resources/Speaker 4 - Pierfrancesco Alaimo Di Loro/README.md: -------------------------------------------------------------------------------- 1 | # Pierfrancesco Alaimo Di Loro 2 | 3 | Bio: I am a Junior Assistant Professor at the Dpt. GEPLI of LUMSA University and collaborator with the S3RI institute of the University of Southampton. My research interests concern the study of spatial and spatio-temporal phenomena, with a particular focus on the Bayesian Hierarchical Modeling of large geo-referenced data. -------------------------------------------------------------------------------- /resources/Speaker 4 - Pierfrancesco Alaimo Di Loro/STPoiAR_StanCon_PAlaimoDiLoro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 4 - Pierfrancesco Alaimo Di Loro/STPoiAR_StanCon_PAlaimoDiLoro.pdf -------------------------------------------------------------------------------- /resources/Speaker 5 - Sujit Sahu/README.md: -------------------------------------------------------------------------------- 1 | # Sujit Sahu 2 | 3 | Package: [bmstdr](https://cran.r-project.org/web/packages/bmstdr/vignettes/bmstdr-vig_bookdown.html) 4 | 5 | Bio: Sujit Sahu is a Professor of Statistics at the University of Southampton. He is the author of the book Bayesian modeling of spatio-temporal data with R published by Chapman and Hall/CRC Press. 6 | 7 | Talk recording can be accessed [here](https://www.dropbox.com/s/3jpefv149oa86ka/SujitSahu_StanConnect.mp4?dl=0). 8 | -------------------------------------------------------------------------------- /resources/Speaker 5 - Sujit Sahu/olsks_stanconnect.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 5 - Sujit Sahu/olsks_stanconnect.pdf -------------------------------------------------------------------------------- /resources/Speaker 5 - Sujit Sahu/sujitsahu_abstract.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Fitting spatio-temporal geostatistical models in Stan using the bmstdr R package. " 3 | output: 4 | BiocStyle::html_document: 5 | number_sections: true 6 | toc: true 7 | date: "`r format(Sys.Date(), format='%B %d, %Y')`" 8 | author: 9 | - name: Sujit K. Sahu 10 | affiliation: University of Southampton 11 | email: S.K.Sahu@soton.ac.uk 12 | package: bmstdr 13 | abstract: > 14 | In this talk I present the recently published `R` package `r BiocStyle::CRANpkg("bmstdr")` that is able to fit several Bayesian spatial and spatio-temporal models. Point referenced data are modeled using Gaussian processes and Gaussian error distributions. Two model fitting engines: `Bspatial` for spatial only point referenced data and `Bsptime` for spatio-temporal data are included in the package. Both of these engines admit "Stan" as one of the package options among other possibilities such as `r BiocStyle::CRANpkg("spBayes")`, `r BiocStyle::CRANpkg("spTimer")`, `r BiocStyle::CRANpkg("spTDyn")` and `r BiocStyle::Rpackage("INLA")`. A third model fitting function, `Bmoving_sptime`, is provided for fitting irregularly observed spatio-temporal data possibly from a set of moving sensors. 15 | 16 | 17 | The user of `r BiocStyle::CRANpkg("bmstdr")` is afforded the flexibility to name particular rows of their input data frame for validation purposes. 18 | The package allows quick comparison of models using both model choice criteria, such as DIC and WAIC, and K-fold cross-validation without much programming effort. Familiar linear model fit exploration tools and diagnostic plots are included through the S3 methods such as `summary`, `residuals` and `plot` implemented for the three `r BiocStyle::CRANpkg("bmstdr")` functions. Our illustrations show that compared to some other packages Stan fitted spatio-temporal models validate better, and also perform better according to some model choice criteria such as the WAIC. 19 | 20 | 21 | 22 | 23 | keywords: Areal data, CAR models, geostatistical data modeling, model choice and validation 24 | 25 | vignette: > 26 | %\VignetteEncoding{UTF-8} 27 | %\VignetteIndexEntry{bmstdr: Bayesian Modeling of Spatio-Temporal Data with R} 28 | %\VignetteEngine{knitr::rmarkdown} 29 | --- 30 | ```{r style, echo = FALSE, results = 'asis'} 31 | BiocStyle::markdown() 32 | ``` 33 | ```{css, echo=FALSE} 34 | .watch-out { 35 | background-color: lightpurple; 36 | border: 3px solid purple; 37 | font-weight: bold; 38 | } 39 | ``` 40 | ```{r, include = FALSE} 41 | knitr::opts_chunk$set( 42 | collapse = TRUE, 43 | class.source="watch-out", 44 | comment = "#>") 45 | ``` 46 | 47 | -------------------------------------------------------------------------------- /resources/Speaker 6 - Silvia De Nicolo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 6 - Silvia De Nicolo/.DS_Store -------------------------------------------------------------------------------- /resources/Speaker 6 - Silvia De Nicolo/README.md: -------------------------------------------------------------------------------- 1 | # Silvia De Nicolo 2 | 3 | R Package tipsae: [CRAN version](https://cran.r-project.org/web/packages/tipsae/index.html), [GitHub version](https://github.com/silviadenicolo/tipsae) 4 | 5 | Bio: Post-Doctoral Fellow at the University of Bologna, her main research interests concern Bayesian hierarchical models, small area estimation and their application to inequality and poverty measurement. 6 | -------------------------------------------------------------------------------- /resources/Speaker 6 - Silvia De Nicolo/slidesTipsae.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 6 - Silvia De Nicolo/slidesTipsae.pdf -------------------------------------------------------------------------------- /resources/Speaker 6 - Silvia De Nicolo/tipsae_package_vignette.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 6 - Silvia De Nicolo/tipsae_package_vignette.pdf -------------------------------------------------------------------------------- /resources/Speaker 7 - Connor Donegan/Donegan.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 7 - Connor Donegan/Donegan.pdf -------------------------------------------------------------------------------- /resources/Speaker 7 - Connor Donegan/README.md: -------------------------------------------------------------------------------- 1 | # Connor Donegan 2 | 3 | Package: [geostan](https://connordonegan.github.io/geostan) ([Vignettes](https://connordonegan.github.io/geostan/articles/index.html)) 4 | 5 | Bio: Connor Donegan is a doctoral candidate in Geospatial Information Sciences at The University of Texas at Dallas, and a research assistant in the Peter O'Donnell Jr. School of Public Health at UT Southwestern Medical Center. He studies health geography, spatial statistics, and epistemology. 6 | -------------------------------------------------------------------------------- /resources/Speaker 8 - Marco Gramatica/2022_07_StanConnect_HANDOUT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 8 - Marco Gramatica/2022_07_StanConnect_HANDOUT.pdf -------------------------------------------------------------------------------- /resources/Speaker 8 - Marco Gramatica/README.md: -------------------------------------------------------------------------------- 1 | # Marco Gramatica 2 | 3 | Bio: Marco Gramatica has just completed his PhD with a thesis on Bayesian modelling of spatially misaligned data. His research focused on the use of CAR priors and Multiple Membership to jointly model data recorded on different spatial frameworks. He is now a Postdoctoral Research Assistant at Queen Mary University of London. [Linktree](https://linktr.ee/marcogramatica) -------------------------------------------------------------------------------- /resources/Speaker 9 - Victoire Michel/README.md: -------------------------------------------------------------------------------- 1 | # Victoire Michal 2 | 3 | Bio: Victoire is a PhD student in the Biostatistics graduate program at McGill University. She studies Spatial Statistics and Disease Mapping to model the cases of Zika in Rio de Janeiro as well as Small Area Estimation and Record Linkage to estimate the household consumption in Ghana at a fine aggregation level. She holds a Bachelor’s degree in Mathematics and a Master’s degree in Statistics, both from the University of Montreal. -------------------------------------------------------------------------------- /resources/Speaker 9 - Victoire Michel/Slides_StanConnect_Victoire.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stan-dev/connect22-space-time/f7aa7768eb4a1532935a10064efb48c49a210364/resources/Speaker 9 - Victoire Michel/Slides_StanConnect_Victoire.pdf --------------------------------------------------------------------------------