# R: how to get started

We have developed a series of exercises to become familiar with the software R. Exercises include frequentist and Bayesian analyses.

Note: Since we continuously improve the tutorials, let us know if you discover mistakes, or if you have additional resources we can refer to. The source code is available via Github. If you want to be the first to be informed about updates, follow Rens on Twitter.

## 1. R for beginners

This tutorial provides the basics of R for beginners. Our detailed instruction will start from the foundations including the installation of R and RStudio, the structure of the R screen, and loading the data. Next, we introduce basic functions for data exploration and data visualization. Also, we illustrate how to do statistical analyses such as correlation analysis, multiple linear regression, t-test, and one-way analysis of variance (ANOVA) with easy and intuitive explanations.

## 2. Frequentist linear regression

This tutorial provides the reader with a basic tutorial on how to perform a frequentist regression analysis in R. Throughout this tutorial, the reader will be guided through importing datafiles, exploring summary statistics, and regression analyses. Here, we will exclusively focus on frequentist statistics.

## 3. Bayesian linear regression (using brms)

This tutorial provides the reader with a basic tutorial on how to perform a Bayesian regression in brms, using Stan as the MCMC sampler. Throughout this tutorial, the reader will be guided through importing data files, exploring summary statistics, and regression analyses. Here, we will exclusively focus on Bayesian statistics.

## 4. Discrete-time survival analysis

This tutorial provides the reader with a hands-on introduction to discrete-time survival analysis in R. Specifically, the tutorial first introduces the basic idea underlying discrete-time survival analysis and links it to the framework of generalized linear models (GLM). Then, the tutorial demonstrates how to conduct discrete-time survival analysis with the `glm` function in R, with both time-fixed and time-varying predictors. Some popular model evaluation methods are also presented. Lastly, the tutorial briefly extends discrete-time survival analysis with multilevel modeling (using the `lme4` package) and Bayesian methods (with the `brms` package).