TubEdu

Regression models in R step by step


Listen Later

In this video, we're running a basic regression model in R (or Rstudio) step by step. We begin by opening R or Rstudio, making sure the working directory is set correctly. You can download the datafile from OSF here: https://osf.io/jgd4b. If you want to follow along the code, you can also download it from OSF: https://osf.io/c3jvm. I created these data purely for illustrative reasons. The code used in the video starts on line 11.

Once everything is in place, we look at three ways to run a regression model. Frequentists will use the built-in lm() command, while rstanarm and MCMCpack offer very easy Bayesian options. For the Bayesian approaches, we need to install packages, and not forget the library() command. Three ways to run your regression models in R, step by step.

00:00 Introduction

00:11 Open data
00:40 Working directory
02:56 Looking at data
03:51 Regression model
04:18 Frequentist lm()
05:25 Bayesian
05:33 rstanarm
06:59 MCMCpack

...more
View all episodesView all episodes
Download on the App Store

TubEduBy