Statistics

Statistics

Linear statistics



# get summary stats
summary (lm(d$rt~d$condition))

# multiple regression
lm1 = lm(d$values~d$factor_1 * d$factor2)
anova (lm1);


# mixed effect model
lmer(DV~ IV1 + IV2 + (1|RadnomEffect),data=subset(myData, !ID %in% bplot$out))


# Calculate z-scores
zscores = (d$values - mean(d$values)) / sd($d$values)

# Get probabilities
pnorm(zscore)

# set quantitative value to factor
data$Diagnosis = factor (data$Diagnosis, levels = c('CON','SIBS','ADHD'))

# filter outliers
bplot = boxplot(data$dependent_measure~data$independent_measure)
outliers = data$ID[data$dependent_measure %in% bplot$out ]


Groupwise stats with dplyr

library(dplyr)
library(broom)
lms = dt.long %>% filter (!is.na(value)) %>% group_by (variable) %>% do( l1 = lm(value~date, data = .))
tidy(lms, l1)