data skills- Testing median + cat variables

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

20 Terms

1
New cards

How can you compare categorical variables

Can be compared based on the proportion of people who fall into each category of the categorical variable

  • can be summarised in a two-way table


2
New cards

What is the chi-square test

A test used to explain the relationship between two categorical variables by comparing the actual counts with the expected counts

  • a non-parametric test that does not need a normal distribution


3
New cards

how to intrepret the chi-square test statistic

Quantifies the comparison between the observed and expected results if the null hypothesis were true

  • Sum of all cells’ (observed count - expected count)2/expected count

  • If above the critical value, then we can reject the null hypothesis


4
New cards

how is the p-value calculate in a chi-square test

uses a statistical distribution of x2 with a df of (r-1) x (c-1)

  • r = no of rows

  • c = no of columns


5
New cards

how to calculate expected count

used to calculate what resulst would look like if the null hypothesis were true

  • the sum of a row x the sum of a column / the total number of observations


6
New cards

what are the assumptions of the chi-square test

  • The test becomes more accurate as the counts in each cell get larger, so we use it when no more than 20% of expected counts are below 5, and all expected counts are above or equal to 1

  • need to be a fixed number of observations and a fixed number of answers (can’t be short answer, only multiple choice)


7
New cards

what are the hypotheses for the chi-square test

null: variable one and variable 2 are independent

  • One categorical variable does not lead to a change in another (men will not always like dogs more than cats)

alternative hypothesis: variable 1 and variable 2 are dependent

  • if you are a man you a more likely to prefer dog more than cats


8
New cards

what are residuals

When we reject the null hypothesis, we can look at residuals to determine the association between each variable

  • residuals = observed - expected

  • Basically, what is the extent of the relationship between the variables


9
New cards

What is a standardised residual

A measure of how much a cell contributes to the test statistic

  • observed - expected / square root of expected

  • A result >2 or < -2 indicates a significant difference between expected and observed (there is an association between variables)


10
New cards

What to use when normal distribution can’t be assumed

You can use non-parametric tests to determine the statistical significance between variables where a normal distribution cannot be assumed

  • Can also be done if outliers are present



11
New cards

What are non-parametric tests

a test that involves ranking numbers rather than focusing on their values

  • the Mann U Whitney test ( aka wilcoxon rank sum test) used an alternative to a two-sample test)

  • Wilcoxon signed rank test used as an alternative to one-sample or match pair test


12
New cards

How to undergo a Mann-Whitney U test

  1. order the whole data and rank each observation from lowest(1) to highest(10)

  2. add up all the ranks for each sample ( R1 = sample 1, R2 = sample 2)

  3. calculate the test statistic


13
New cards

what to do if two value are the same when rank

you give ecah number the average of the two ranking they would fufill if they weren’t the same number

  • two rankings tied for 2nd place, 2+3/2 = 2.5


14
New cards

How to caluclate the test statistic

U = R1-n (n1 + 1)/2

  • n1: number of observations in 1 sample

  • calculates how often a rank from one group proceeds the rank of the other group


15
New cards

what are the hypothesises for a mann whitney U test

Null: no difference between the samples

Alternative: difference between each group

16
New cards

what if the samples have the same sampling ditsribution

if the samples have the same shape and spread then we look at their median

  • Null: median 1 - median 2 = 0

  • A: median 1 - median 2 doesn’t = 0


17
New cards

what are the hypothesis in a wilcoxon signed rank test ( matched pair)

Null: no systematic difference between pairs

Alternative: systematic difference between the pairs

18
New cards

How to calculate the test statistic ( matched pair)

  1. Determine the difference between all the pairs in the data set

  2. Order the differences based on value and rank

  • pairs with = differences are given the same rank

  • when differences are equal, they are excluded from the ranking system

  1. calculate Wt, which is the sum of the rankings of all the positive differences


19
New cards

what is a Wilcoxon signed-rank test ( one sample)

a test used when the sample for a one-sample test is not normally distributed or contains outliers

Null: median = m0 (null value)

alternative: median doesn’t = m0 (null value)

  • the tests stat is calculated the same but we determine the differences between each value and the null value


20
New cards

How are p-values calculated in these test

Typically calculated using RStudio as an output from the test

  • If the sample has fewer than 50 values, the p-value then results are exact, if not an approximation of the p-value is used