Category Archives: Tutorials

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

IPython magic commands

Jupyter notebooks are a scientific computing development platform that can run many different programming languages, including Python via the interactive Python interpreter IPython. The key advantage in a notebook environment is that code can be sectioned into cells for testing while retaining all the interactive features of IPython, including magic commands. IPython magics are a specialised set of commands hosted

Read more

Independent t-test in Python

In a previous post we learned how to perform an independent t-test in R to determine whether a difference between two groups is important or significant. In this post we will learn how to perform the same test using the Python programming language. Along the way we will learn a few things about t distributions and calculating confidence intervals. dataset.In

Read more
« Older Entries