Week 1 Homework
1. Why do we want to use programming for statistical analysis?
2. Look at the following chunks of code and list what the output would be (without using R):
a.
a <- 2
b <- a + 3
print(b)
b.
course <- “STA”
print(course)
print(“B”)
print(20+3)
c.
one <- 5
two <- 9
three <- 2
print(one+two+three)
a.
a <- 2
b <- a + 3
print(b)
b.
course <- “STA”
print(course)
print(“B”)
print(20+3)
c.
one <- 5
two <- 9
three <- 2
print(one+two+three)
3. Let’s say we work at a pharmacy and we’re interested in the expiration of bottles of
vitamins at the pharmacy. We want to know how long the vitamins have left til expiration
when they are purchased. We start tracking when each bottle arrives at the store, when
it is sold, and what it’s expiration date is.
a. Think about how we might organise our spreadsheet.
i. What does each row represent?
ii. What are some of the columns?
b. For our analysis, we want to know the following pieces of information. For each
one, write whether we should record that in the spreadsheet or wait until we are
doing our analysis?
i. The type of vitamin
ii. The amount of time left til expiration on the date of sale
iii. The date of manufacture printed on the bottle
vitamins at the pharmacy. We want to know how long the vitamins have left til expiration
when they are purchased. We start tracking when each bottle arrives at the store, when
it is sold, and what it’s expiration date is.
a. Think about how we might organise our spreadsheet.
i. What does each row represent?
ii. What are some of the columns?
b. For our analysis, we want to know the following pieces of information. For each
one, write whether we should record that in the spreadsheet or wait until we are
doing our analysis?
i. The type of vitamin
ii. The amount of time left til expiration on the date of sale
iii. The date of manufacture printed on the bottle
4. Let’s say we’re running a speech perception experiment, and we have all our
participants fill out these slips:
a. After the experiment, we enter all of these slips into a spreadsheet. How do you
think it should look? Draw it or describe it.
b. Let’s say we then ran a follow-up experiment to compare against the results of
the first experiment. We use the same language background slips. How do we
add this new data to our spreadsheet?
participants fill out these slips:
a. After the experiment, we enter all of these slips into a spreadsheet. How do you
think it should look? Draw it or describe it.
b. Let’s say we then ran a follow-up experiment to compare against the results of
the first experiment. We use the same language background slips. How do we
add this new data to our spreadsheet?
