Implementing a particle filter in C++ using Rcpp (part 2)

In my previous blog post I showed how to implement a particle filter in C++.

In this post I will implement a backward-simulation particle smoother (see Example 3 in the code below) and a method for forecasting with the particle filter (Example 4) in C++. By using R packages Rcpp (version 0.12.11) and RcppArmadillo (version 0.7.800.2.0) it is possible to subsequently run this smoother and forecasting method in R. Continue reading Implementing a particle filter in C++ using Rcpp (part 2)

Implementing a particle filter in C++ using Rcpp (part 1)

In one of my previous blog posts I demonstrated how to implement a particle filter in R.

In this post I’m going to implement the same particle filter, but this time I’ll program the filter in C++. The R packages Rcpp (version 0.12.11) and RcppArmadillo (version 0.7.800.2.0) will make it possible to subsequently run this filter in R, since these two R packages allow us to connect C++ to R. Continue reading Implementing a particle filter in C++ using Rcpp (part 1)

R code for fitting a model to unbalanced longitudinal data with a copula

In my previous blog post I showed how to fit a model to longitudinal data with a copula.

Remember that the focus in my previous post was on balanced longitudinal data. However, the following R code demonstrates how to fit a copula when dealing with unbalanced longitudinal data. Continue reading R code for fitting a model to unbalanced longitudinal data with a copula

R code for fitting a model to longitudinal data with a copula

The R code below demonstrates how to fit a model to longitudinal data by means of a copula. Longitudinal data is also referred to as panel, or repeated measures data.

The R code also shows how to create forecasts for longitudinal data, and how to compute prediction intervals for these forecasts. Continue reading R code for fitting a model to longitudinal data with a copula

R code for fitting a quantile regression model to censored data by means of a copula

In my previous blog post I showed how to fit a copula to censored data. For the ease of use, I’m going to call these fitted copulas censored copulas.

The following R code demonstrates how these censored copulas in turn can be used for fitting a quantile regression model to censored data.

A more detailed description of the method employed for fitting the quantile regression model can be found in this blog post. Continue reading R code for fitting a quantile regression model to censored data by means of a copula