Open krittschof opened 3 years ago
You need to read the passengers data in first (copy the code from the lab instructions) then construct the other variables using the data structure described for an interrupted time series.
Using the first ten observations for simplicity here. In this demo the intervention starts in period 6.
passengers <-
c(1328, 1407, 1425, 1252, 1287, 1353, 1301, 1294, 1336, 1371)
time <- 1:10 # or 1:length(passengers)
# sequence of 5 zeros followed by 5 ones:
treat <- c( rep(0,5), rep(1,5) )
# or using an ifelse statement since we know it starts in period 6
treat <- ifelse( time > 5, 1, 0 )
# sequence of 5 zeros followed by new counter
time.since <- c( rep(0,5), 1:5 )
d <- data.frame( passengers, time, treat, time.since )
d
passengers | time | treat | time.since | |
---|---|---|---|---|
1 | 1328 | 1 | 0 | 0 |
2 | 1407 | 2 | 0 | 0 |
3 | 1425 | 3 | 0 | 0 |
4 | 1252 | 4 | 0 | 0 |
5 | 1287 | 5 | 0 | 0 |
6 | 1353 | 6 | 1 | 1 |
7 | 1301 | 7 | 1 | 2 |
8 | 1294 | 8 | 1 | 3 |
9 | 1336 | 9 | 1 | 4 |
10 | 1371 | 10 | 1 | 5 |
Please remember the rule of thumb that you should post a question if you are stuck for more than 20 minutes.
These are not meant to be gotcha questions, but in this final regression class they do require you to synthesize information from the lectures and apply it.
If you have not completed CPP 526 yet this course will be more challenging. Don't be afraid to ask questions or schedule office hours.
Thank you Dr. Lecy. I have completed CPP 526 last year and did very well. I will take advantage of office hours and I just emailed Dr. Selby.
I always recommend starting with a toy example like this, and often with pen and paper or pseudocode.
Make sure you know what your goal is before diving into the code or you will get double-confused. I still write out my pseudocode before diving into syntax.
These upper level regression classes are fun because they require you to grapple with the statistics content and with R code at the same time. If you are stuck try to pay attention to which is stumping you.
R code is easy enough to fix. If you are stuck on the statistical concepts then questions on discussion boards are welcome, but also consider scheduling office hours to talk through the models.
There is no easy way to learn stats - you need to connect all of the dots to make sense of the models. Talking them through can help - speech uses a different part of the brain so it can be generative. Ask conceptual questions on discussion boards - trying to articulate a question can actually help you understand the problem better. These are not signs of struggle but of learning.
If you have not completed CPP 526 yet this course will be more challenging.
The new cohort starting this summer may be taking CPP 526 and 525 concurrently if they are doing the program full-time.
Happy Friday! I need assistance and guidance with Lab 1 Q1a, Create the three variables.... I read prior CPP 525 issues from Summer 2020 and Fall 2020 (but appears to be dated in March 2021) and read the Lecture. Further, I am googling galor, copying and pasting the errors and/or key words to asist. I am aware based on the readings and guidance that the Passengers is a Vector; thus the lecture example is not applicable. However, I am very unsuccessful moving forward and have been working on Q1a for over 3 hours now. I would love to provide you with some sort of code, but I have deleted, tried again, wrote, knit, ran, error, over and over again. I do not have anything but the following:
This is the only thing that somewhat resembles the dataset should look like. But the data is not there.
Can you please post here some references, resources, correct examples, of how to do this. I do not want then next 7 weeks to be like this. I am for a challenge, but ya know...
Thanks.