Week 2- r studio notes Flashcards
what packages do you need to load in and in what order
library(broom)
library(car)
library(Hmisc)
library(lsr)
library(tidyverse)
big cats hate losing tennis
how to measure the assumption: is there a data point for each participant on both variables
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 to check if the data is normally distributed
ggplot(mh_check, aes(x=Abil))+
geom_histogram() +
theme_bw()
also…
qqPlot(x = mh$Abil)
how to check if the relationship between variables appear linear?
calculate a ggplot from last week
how do you conduct a correlation analysis using spearman’s r
corSp_results <- cor.test(mh$Abil,
mh$IQ,
method = ‘spearman’,
alternative= ‘two.sided’ %>%
tidy()
(very similar to pearson’s R)
how do you conduct a correlation matrix
mh <- mh %>%
select (-Participant)
pairs (mh)
how do you create an intercorrelation
mh <- as.data.frame(mh)
intercor_results <- correlate (x=mh,
test= TRUE,
corr.method = pearson
p.adjust.method = bonferroni
intercor_results()