## Tag Archives: R

## Simple linear regression in R

In statistics, we often want to fit a statistical model to be able to make broader generalizations. An important type of statistical model is linear regression, where we predict the linear relationship between an outcome variable and a predictor variable. In this post we will learn how to perform a simple linear regression in R. See our previous post for

Read more## Verify if data are normally distributed in R: part 2

In our previous post, we learned how to inspect whether or data were normally distributed or not using plots. It is always important to visualise our data. However, inspecting such plots is open for interpretation and, possibly, abuse. We will now learn how to analyse our data and generate numerical values that describe how our data are distributed. Quantifying the

Read more## Verify if data are normally distributed in R: part 1

Many statistical tests assume that the sampling distribution is normally distributed. This does not mean that the data we collected for our experiment is normally distributed, but rather that the distribution of mean values from many samples of the same size will be normally distributed. Unfortunately, we do no have access to the sampling distribution. However, based on the central

Read more## R: How to reshape data from wide to long format, and back again

Many studies take repeated observations on subjects. For example, clinical trials record outcomes from subjects before and after treatments, and laboratory studies might record physiological outcomes from the same subjects over time. In a dataframe, when observations from each subject are written on one row and repeated observations are stored as different column variables, we say the data are in

Read more## Add jitter to your figures using Python and R

Scientific figures are at their most informative when they include the individual data used to calculate summary statistics such as means and standard deviations. Why is showing data important? As previously pointed out here and here, figures with means, standard deviations, standard errors, etc. can be misleading and conceal the nature of the underlying data. As highlighted in our previous

Read more