Key Points

Reproducible Data Analysis


  • A reproducible analysis records data, code, software dependencies, and analytical decisions.
  • Rendering an R Markdown document executes the code in a defined order.
  • Analyses should not depend on objects saved in the workspace.

Reading data from fileCountryNamePhonenumber


  • The readr version of read_csv() is preferred
  • Remember that csv is not always actually separated with commas.
  • The haven package contains functions for reading common proprietary file formats.
  • In general a package will exist for reading strange datatypes. Google is your friend!
  • Use code to read in your data

Descriptive Statistics


  • We have access to a lot of summarising descriptive indicators the the location, spread and shape of our data.

Histograms


  • Histograms are used for visualising the distribution of data
  • A lot of different rules for chosing number of bins exists
  • Binwidth and number of bins are equivalent
  • Chose the number of bins that best supports your data story. Without hiding inconvenient truths about your data.
  • Never use unequal binwidths
  • Consider using natural breaks as an alternative

Table One


  • A Table One provides a compact describtion of the data we are working with
  • With a little bit of work we can control the content of the table.

Table One - gt


  • A Table One provides a compact describtion of the data we are working with
  • With a little bit of work we can control the content of the table.

Tidy Data


  • Each variable should occupy one column, each observation one row, and each value one cell.
  • Information encoded in headers, colours, or layout should generally become explicit values.
  • Tidy structure simplifies transformation, visualisation, modelling, and reuse.

The normal distribution


  • Use .md files for episodes when you want static content
  • Use .Rmd files for episodes when you need to generate output
  • Run sandpaper::check_lesson() to identify any issues with your lesson
  • Run sandpaper::build_lesson() to preview your lesson locally

Testing for normality


  • Begin by a visual inspection to assess if data is normally distributed
  • Use a statistical test to support your conclusion
  • Do not fret too much about non-normality. It is quite normal.

How is the data distributed?


  • The data generating function is not necessarily the same as the distribution that best fit the data
  • Chose the distribution that best describes your data - not the one that fits best

Linear regression


  • Linear regression show the (linear) relationship between variables.
  • The assumption of normalcy is on the residuals, not the data!

Multiple Linear Regression


  • We can do linear regression on multiple independent variables
  • Be careful not to overfit - only retain variables that are significant (and sensible)
  • We can fit just as well on categorical variables - but make sure they are categorical
  • Interpreting linear models with multiple variables are not trivial _ Interpreting linear models with interaction terms are even less trivial

LASSO regularisation


  • It is important to avoid overfitting in multiple linear regression.
  • LASSO can remove unnessecary variables in linear models.
  • Cross validation can optimise the LASSO regularisation.

Logistic regression


  • Using the predict-function to predict results is the easier way

Central Limit Theorem


  • The mean of a sample can be treated as if it is normally distributed

Nicer barcharts


  • Relatively small changes to a bar chart can make it look much more professional

Power Calculations


  • Use .md files for episodes when you want static content

k-means


  • kmeans is an unsupervised technique, that will find the hidden structure in our data that we do not know about
  • kmeans will find the number of clusters we ask for. Even if there is no structure in the data at all

ANOVA


  • Use .md files for episodes when you want static content

Cohens Kappa


  • With two raters Cohens \(\kappa\) can be used as a measure of interrater agreement on categorical, nominal classes.
  • Other methods exists for ordinal classes, and more than two raters.

R on UCloud


  • UCloud provides access to a multitude of advanced software that we are not able to run locally
  • Running RStudio on UCloud gives us access to more compute and memory than we have on our own computer
  • Restarting a virtual machine means all our work and setup might be lost, unless we take certain precautions.
  • More advanced work might require a quite complicated setup

Parallellization in R


  • Parallellization means that a task for your computer can be split up into several smaller tasks that can be done side-by-side.
  • It is not always possible or worthwhile.
  • When parallellization is possible, it could allow your code to run much faster, because you are using multiple cores at once.

A deeper dive into pipes


  • The base-R, native, pipe |> is faster than the magrittr pipe, %>%
  • The magrittr package provides a selection of other useful pipes

Setup for GIS


  • Working with geospatial data requires additional software

Introduction to Spatial Data Science


  • FIXME

Downloading Sentinel satelite data


  • To minimize the size of data, choose only the area needed
  • Choose the spectral bands you need, instead of everything

Raster data


  • FIXME

Spatial Vector Data


  • FIXME

Spatial visualization


  • FIXME

Interactive maps


  • FIXME

Setup for Git


  • RStudio, Git and a GitHub account are needed for this lesson

Introduction to Git(Hub)


  • Version control helps track changes to files and projects
  • Git and GitHub are not the same
  • Git commands are written as git verb options

Practice makes perfect


  • A multitude of materials for learning Git and GitHub exists
  • Try to use Git and GitHub in your daily work

Statistical tests


  • Use an appropriate statistical test
  • Make sure you understand the assumptions underlying the test

When install.packages fail


  • Use .md files for episodes when you want static content

Extracting tiff-layers


  • Layered tiff-files can contain different information

Fences på vores undervisningssider


  • Fences giver indholdet semantisk struktur og ikke kun en bestemt farve.
  • Indlejrede fences skal lukkes i omvendt rækkefølge af den, de blev åbnet i.
  • solution og hint hører normalt til en konkret challenge.
  • Instructor-noter kan vises for undervisere uden at fylde i kursistvisningen.
  • Komponenter, som Workbench ikke officielt understøtter, bør testes før de bruges i kursusmateriale.

Make a new course


  • A repository created from the template is an independent copy and does not receive later changes automatically.
  • Episode order and visibility are controlled through config.yaml.
  • Unused episode files can still increase dependency installation and build time.
  • The lesson should be built and checked before publication.
  • Releases, citations, and DOIs must refer to the new course rather than to the original template.