This final post about the STAN platform will specifically focus on data visualizations that can come from STAN models. In particular, we will explore these visualizations by hand with the popular shinystan package. As we already know, the STAN platform typically uses particular Markov Chain Monte Carlo (MCMC) algorithms: the Hamiltonian Monte Carlo (HMC) or […]
Exercises (intermediate)
R FOR HYDROLOGISTS – Seasonality and Trend Decomposition
R FOR HYDROLOGISTS SEASONALITY AND TREND DECOMPOSITION If you don’t have the data, please first get it from the first tutorial here. Also, you need to install and load the ggplot2 package. if(!require(ggplot2)){install.packages(ggplot2, dep=T)} Answers to these exercises are available here. Time series decomposition is a mathematical procedure which transforms a time series into multiple different […]
Applied Economic Analysis With R – Part 1: Exercises
R has great potential in Economic data analysis, as well as econometrics. In this set of exercises, we will go through a wide variety of topics in econometrics, including wage equations, growth regressions, dynamic regressions and time series models, hedonic regressions, the demand for health care, and labor force participation. In the first set of […]
MCMC Using STAN – Diagnostics With The Bayesplot Package: Exercises
This exercise set will continue to present the STAN platform, but with another useful tool: the bayesplot package. This package is very useful to construct diagnostics that can be used to have insights on the convergence of the MCMC sampling since the convergence of the generated chains is the main issue in most STAN models. […]
R FOR HYDROLOGISTS – Correlation and Information Theory Measurements: Part 3: Exercises
R FOR HYDROLOGISTS CORRELATION AND INFORMATION THEORY MEASUREMENTS – PART 3 Before we begin, if you don’t have the data, first get it from the first tutorial here. You will also need to Install and load the ggplot2 and reshape2 packages. if(!require(ggplot2)){install.packages(ggplot2, dep=T)} if(!require(reshape2)){install.packages(reshape2, dep=T)} Answers to these exercises are available here. The mutual information quantifies […]
Loops in R – Exercises
Using loops is generally discouraged in R when it is possible to avoid them using vectorized alternatives. Vectorized solution are be both faster to write, read and execute – except sometimes they aren’t and the definition of vectorization isn’t always straightforward. In any event, solutions using loops can be: The fastest to prototype The easiest […]
R FOR HYDROLOGISTS: Correlation and Information Theory Measurements – Part 2: Exercises
R FOR HYDROLOGISTS CORRELATION AND INFORMATION THEORY MEASUREMENTS (Part 2) Proposed back in the 40’s by Shannon Information theory provide a framework for the analysis of randomness in time-series, and information gain when comparing statistical models of inference. Information theory is based on probability theory and statistics. It often concerns itself with measures of information […]
MCMC Using STAN – Introduction With The Rstanarm Package: Exercises
This exercise set will continue the introduction to the STAN platform and its main features. Whereas the first post introduced the rstan package, we will now present the rstanarm package and related features. The goal here is to fit a series of regressions predicting cognitive test scores of children given characteristics of their mothers, using […]
R FOR HYDROLOGISTS – Part 1: Correlation and Information Theory Measurements
R FOR HYDROLOGISTS CORRELATION AND INFORMATION THEORY MEASUREMENTS (Part 1) In this tutorial, we will show you how to apply tools, such as the correlation, auto-correlation, entropy, and mutual information as an introductory exercise in the analysis of time series dynamics. The first measurement that we will calculate will be the linear correlation. This statistic […]
Working With Air Quality and Meteorological Data – Part 10: Exercises
Atmospheric air pollution is one of the most important environmental concerns in many countries around the world. It is strongly affected by meteorological conditions. In this set of exercises, we will use the openair package to work with and analyze air quality and meteorological data. This package provides tools to directly import data from air quality […]