Week 2- r studio notes Flashcards

1
Q

what packages do you need to load in and in what order

A

library(broom)
library(car)
library(Hmisc)
library(lsr)
library(tidyverse)

big cats hate losing tennis

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

how to measure the assumption: is there a data point for each participant on both variables

A

mh_check <- mh %>%
filter(!is.na(Abil)) %>%
filter(!is.na(IQ))

o Mh_check is reading in the file
o Pipe operator
o Filtering out any NAs in ability and IQ (remember to put pipe operator between)
o Looking in the environment there will be the same number of observations if there is no NAs

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

how to check if the data is normally distributed

A

ggplot(mh_check, aes(x=Abil))+
geom_histogram() +
theme_bw()

also…

qqPlot(x = mh$Abil)

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

how to check if the relationship between variables appear linear?

A

calculate a ggplot from last week

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

how do you conduct a correlation analysis using spearman’s r

A

corSp_results <- cor.test(mh$Abil,
mh$IQ,
method = ‘spearman’,
alternative= ‘two.sided’ %>%
tidy()

(very similar to pearson’s R)

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

how do you conduct a correlation matrix

A

mh <- mh %>%
select (-Participant)

pairs (mh)

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

how do you create an intercorrelation

A

mh <- as.data.frame(mh)
intercor_results <- correlate (x=mh,
test= TRUE,
corr.method = pearson
p.adjust.method = bonferroni

intercor_results()

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