Course meeting time: Thursday, 10:15 - 11:45, Missionsstrasse 64a, Computerraum 00.010

Syllabus (you’re looking at it) webpage: http://rpubs.com/ajluck/Syllabus2018Autumn

Instructor: Ashley Luckman, ashleyjames.luckman@unibas.ch

Office Hours: By appointment (or you can stop by my office at Missionsstrasse 62A and hope I am in)

Schedule and assignments

Your homework for each class period is to actively read the readings for that week. A link to the textbook is below. All of the work you turn in will be done in class as WPAs (Weekly Programming Assignments).

New WPAs and readings will be uploaded weekly, so check back regularly.

Week - Date Topic Texbook readings Assignment (in class)
1 - 20 September Introduction None WPA #0
2 - 27 September R basics, scalers and vectors Chapters 1-4, 5, 6 WPA #1, Answers- WPA #1
3 - 4 October Indexing Vectors Ch 7 WPA #2, Answers- WPA #2
4 - 11 October Matrices and Dataframes, Managing data Ch 8, Ch 9 WPA #3, Answers- WPA #3
5 - 18 October Dataframe manipulation Ch 9, Ch 10 WPA #4, Answers- WPA #4
6 - 25 October Plotting Ch 11, Ch 12 WPA #5, Answers- WPA #5
7 - 1 November 1 and 2 sample Hypothesis tests Ch 13 WPA #6, Answers- WPA #6
8 - 8 November QUIZ - Quiz Feedback
9 - 15 November ANOVA with aov() and anova() Ch 14 WPA #7, Answers- WPA #7
10 - 22 November Linear regression with lm() Ch 15 WPA #8 , Answers- WPA #8
11 - 29 November Writing Functions and Loops Ch 16, 17 WPA #9, Answers- WPA #9
12 - 6 December Final project work - Evaluation, Final Project Information, Final Project Simulated Data, R Markdown Intro
13 - 13 December Final project work - -
14 - 20 December Final project work - -
End - 20 December Final Project Due!!! - -

Course Description

R is one of the most popular statistical languages for both academic researchers and data analysts working in industry. The reason why is simple - R is free, easy to use and incredibly powerful. With R you can generate and manipulate data, conduct analyses, create plots and even write documents. The goal of this course is to introduce you to R so you can apply it to your current and future research. In this course, you will learn how to use R to conduct all steps of your data analysis, from loading data to performing analyses, to producing figures.

This course is for anyone who wants to learn R. I don’t care if you’re 10 or 100 or what your background is in programming, math, etc.. If you want to learn R and know how to use a computer, this course is for you. That said, the course is designed around the needs of a psychology student in a Bachelor’s, Masters, or PhD program who has taken at least an introductory course in statistics.

This is not a traditional course – this is a ‘flipped’ course. This means that you will be learning the basic material on your own time outside of class, by actively reading and searching online resources, and then ‘learn-by-doing’ in class. For more information about the ‘flipping’ concept, check out https://en.wikipedia.org/wiki/Flipped_classroom.

Materials

To learn the basic material, you will read chapters from the e-book YaRrr! The Pirate’s Guide to R written by Dr. Nathaniel Phillips. A link to the book can be found above, and the schedule will be updated with the relevant chapters weekly.

If you are interested in additional, non-piratey materials, there are numerous books and websites that can help you discover new ways of utilizing R. Three recommended books are:

  1. Data Science with R, by Grolemund and Wickham. A free, online e-book on data science with R.
  2. The R Book, by Crawly by Crawly.
  3. Discovering Statistics Using R, by Field and Miles by Field and Miles

You can also find free R courses at www.coursera.com, www.datacamp.com, and other similar websites. As is the case with most problems, a quick Google search will likely provide good solutions.

Weekly Programming Assignments (WPAs)

During each class you will work on a series of programming tasks called a Weekly Programming Assignment (WPA). You can do this alone, but I encourage you to discuss and/or work with the people around you. The questions on WPAs will start easy to help remind you of the reading, but end hard in order to push your knowledge of the material. At the end of class, you will email your work on the WPA to me to receive credit.

The WPAs are designed to be challening. For that reason, I do not expect you to finish the entire WPA by the end of class. Work hard, ask questions, and complete as many of the problems as you can. The only way to fail your assignment is to not turn it in. You are not expected to continue working on WPAs outside of class. However, each WPA will have a checkpoint to help you know whether you are falling behind or not. If you reach the checkpoint by the end of class, then you are doing just fine. If you do not reach the checkpoint, I strongly encourage you to continue working on the assignment outside of class so that you do not fall behind.

While I encourage you to work on and discuss the WPAs with those around you, it is very important that each student’s work is his/her own. Do not turn in any assignments that you did not contribute to or do not fully understand.

While I will keep track of how often you submit your WPAs, I will not grade them. I will only give you individual feedback if your work looks especially poor, or especially good. Complete answers to WPAs will be posted shortly after each class. It is your responsibility to look over the answers and compare them to your work. Of course, if you have specific questions about the assignment, please email me or come to my office and I will be very happy to help you.

Quiz

To find the quiz files go here

In week 8 there will be a quiz. This serves three purposes: 1) It will help me track how well you are doing in the course and whether you need help; 2) It will help you check how well you are grasping the materials; and 3) It will be used as part of your assessment. If you get less than 1/3 of the questions correct on the quize, you will be at risk of failing the course. This will trigger a meeting with me to discuss your progress, and what you need to do with the remaining WPAs and Final Project in order to pass the course. If you are able to complete most of each weeks WPAs you shouldn’t have a problem achieving the threshold mark in the quiz.

Time/Place

The quiz will take place during class on the 8 of November (10:15am). You will have 1 hour to complete the quiz. If you can not attend class this week you should have contacted me to discuss alternatives.

Format

The format of the quiz is multiple choice, however there will be two formats of multiple choice used:

Single answer questions: This is the standard multiple choice format, where you choose the single answer you think is correct. Correct answers will be worth 1 mark, and incorrect answers 0.

Multiple answer questions: For these questions 1 or more of the answers/options presented is correct, and your task is to select all the correct answers. For these questions you will get 1/X marks for each correct answer you choose, where X is the total number of correct answers. You will also lose 1/X marks for each incorrect answer you choose, however you won’t be able to get a negative mark for a question. For instance, if there are 2 correct answers to a question and you select 1 correct answer (+ 0.5 marks) and 2 incorrect answers (- 1 mark) you will get 0 marks. If you instead select 2 correct answers (+ 1 mark) and 1 incorrect answer (- 0.5 marks) you will get 0.5 marks.

Materials

At the start of class you will be provided with a link to the quiz questions. You will submit your answers to me electronically before the end of the hour. The file name for your answers should be Quiz_Lastname_Firstname. This will be a hands on quiz, where you will be able to use R to perform calculations. For some questions you will be provided with a link to dataset to use when answering these questions. Not all questions will require calculations or be linked to a specific dataset.

During the quiz you will also be allowed to use any notes you have made, including script files from previous weeks. However you will not be allowed to directly access the online WPAs from previous weeks.

Content

The quiz will cover all pre-checkpoint content from WPAs 1-6 (i.e. from basics to hypothesis tests). The questions will be a mixture of: reporting the results of operations performed on provided datasets; indicating the correct code to perform a described operation on hypothetical data; indicating which code matches a shown output; indicating which output matches a shown piece of code; reporting particular statistics from output obtained in R; etc.

Final Project

At the end of the course you will complete a final analysis project. In this project, you will produce a report containing several key analyses from a dataset of your choosing. If you have a specific dataset you would like to analyze (such as from your thesis, or one available from a paper you are interested), you are welcome to use it. However, you will be provided with a list of tasks to complete/questions to answer which you must be able to complete using your dataset. Most Experimental datasets should be appropriate. If you do not have an appropriate dataset, I will assign one to you. I will give you more details about the project later in the course.

Grading

This is a pass / fail course. Passing the course is not difficult. If you work hard, ask lots of questions, turn in your WPAs, pass the quiz and complete the final analysis project, you’ll pass the class. If you never ask questions, habitually fail to turn in your WPAs, don’t reach the threshold in the quiz and turn in a poor quality final project, you may fail the course.

Missing Class

Attendance at class will be considered when deciding your grade. Therefore, if you can’t attendance a class, there are certain actions you need to take. These depend upon whether you know in advance you will be attending or not.

Emergency/Unforeseen Absence

If something unexpected happens (e.g. sickness, family emergency, car/train breakdowns etc.) and you have to miss class for a week this is ok. In this situation it would be good if you can let me know after class that you missed it. It would also be beneficial for you to catch up on the work in your own time, so that you don’t fall behind. If you miss several classes, then we might need to talk about ways to make sure you don’t fall behind.

Planned Absence

If you know in advance that you won’t be attending a class then the situation is different. In this case I expect you to let me know that you will be missing class, and to submit your completed WPA script by the end of the class for that week. You do not need to provide a reason for your absence in this case. For instance, if you were planning to miss class on the 4/10/2018, where we complete WPA 3, then I would expect you to email me a completed R script for WPA 3 by 11.45 am on Thursday 4/10/2018 (i.e. the end of the class). In general the link to each WPA will go online the weekend preceding that class, so you will have approximately 5 days to complete it.

Unlike in class, where I expect you to only complete as many exercises as the time allows, if you aren’t attending you need to complete all exercises for the week. If you fail to submit the completed WPA by the deadline twice, without an appropriate reason, then you will fail the course. If you are having trouble with the WPA for the week you can, off course, email me with questions or arrange a time to meet.

Tips

Learning R will be challenging, but ultimately rewarding. However it will be a lot easier if you ask questions. Here are the best ways to ask.

Use the help function

If you are unsure how a function works or what its doing, type ?functionname into the console (functionname should be the name of the function e.g. ?mean). Every function has documentation, and this command will bring it up. If you don’t know the exact function name, you can also type ??thingIamlooking (.e.g. ??mean) to perform a search for related documentation.

Google Everything

If you have a problem (particularly outside class) Google it. Almost every question you have, someone else has asked at some point. This applies particularly to R. There are a lot of good forums you might end up on, like stackoverflow.com, or stats.stackexchange.com, where people provide detailed answers. You also might find documentation and functions you couldn’t find using the internal help, or materials from other courses. I Google R and stats related questions daily and am constantly finding innovative answers and new functions. Just keep in mind that there is no point copying someone else’s code if you don’t understand how it works and how to adapt it to your circumstances.

Work together

If you are stuck, ask people around you for help, or if you see someone struggling, help them out. Ideally I want everyone constantly talking and working together in class. Learning any type of programming is a lot easier when you have people to talk to and share ideas and problems with.

Ask me questions

Thats why I’m here. If you don’t know what you are doing, why something doesn’t work (or does work), or what the person next to you is talking about, call me over. If you do know what you are doing, and why it works, but want to make it work better, also call me over. There is nothing worse for me than a class where no one asks me any questions. Also don’t be afraid to email me with questions or to arrange times to meet outside class.