Hypothesis Testing in R Flashcards

1
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

independent samples t-test code

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

p value definition

A

Assuming that there the null hypothesis is true (i.e.; that there is no difference between the groups), what is the probability that we would have gotten a test statistic as far away from 0 as the one we actually got?

It’s a bullshit detector aimed at the null hypothsis. If the p value gets too small, the bullshit detector goes off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Does the p-value tell us the probability that the null hypothesis is true?

A

No!!! The p-value does not tell you the probability that the null hypothesis is true. In other words, if you calculate a p-value of .04, this does not mean that the probability that the null hypothesis is true is 4%. Rather, it means that if the null hypothesis was true, the probability of obtaining the result you got is 4%. Now, this does indeed set off our bullshit detector, but again, it does not mean that the probability that the null hypothesis is true is 4%.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

htest

A

R stores hypothesis tests in special object classes called htest. htest objects contain all the major results from a hypothesis test, from the test statistic (e.g.; a t-statistic for a t-test, or a correlation coefficient for a correlation test), to the p-value, to a confidence interval.

different h tests necessitate data to be loaded into the function in different formats (vectors/dfs or tables)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

names()

A

returns all of the elements in the h.test object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

one sample t-test

A

you can pull data from a df or from separate vectors, it doesn’t have to come from a table() function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

t tests compared to each other in bar chart form

A

you can pull data from a df or from separate vectors, it doesn’t have to come from a table() function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Using subset to select levels of an IV

A

use the %in% argument to specify which levels of an IV you want to test

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

cor.test()

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

two ways to run a correlation test

A

To run a correlation test between two variables x and y, use the cor.test() function. You can do this in one of two ways, if x and y are columns in a dataframe, use the formula notation (formula = ~ x + y). If x and y are separate vectors (not in a dataframe), use the vector notation (x, y):

you can pull data from a df or from separate vectors, it doesn’t have to come from a table() function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

example correlation test

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

using subset() in the cor.test() function

A

Just like the t.test() function, we can use the subset argument in the cor.test() function to conduct a test on a subset of the entire dataframe. For example, to run the same correlation test between a pirate’s age and the number of parrot’s she’s owned, but only for female pirates, I can add the subset = sex == “female” argument:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

chisq.test()

A

used to determine whether there is a significant association between two categorical variables

you must create a table of data to feed a chisq.test function

this example has one nomial variable, and we are testing to see if the likelihood is equal that a pirate would attend either school.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

2 sample chisq.test()

A

If you want to see if the frequency of one nominal variable depends on a second nominal variable, you’d conduct a 2-sample chi-square test.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

apa-style conclusions using the apa() function

A

you can have R take raw h.test results and extract only the relevant data in APA style for you using this function