Summer School Overview Day 0: R bootcamp Day 1: Workflow, Google - - PowerPoint PPT Presentation

summer school overview
SMART_READER_LITE
LIVE PREVIEW

Summer School Overview Day 0: R bootcamp Day 1: Workflow, Google - - PowerPoint PPT Presentation

Summer School Overview Day 0: R bootcamp Day 1: Workflow, Google App Engine Day 2: Online Experiments Day 3: Data wrangling, visualization Day 4: Statistics, Probabilistic models Day 5: Experience sampling Packages and


slide-1
SLIDE 1

Summer School Overview

  • Day 0: R bootcamp
  • Day 1: Workflow, Google App Engine
  • Day 2: Online Experiments
  • Day 3: Data wrangling, visualization
  • Day 4: Statistics, Probabilistic models
  • Day 5: Experience sampling
slide-2
SLIDE 2

Packages and programs

Please install the lme4, brms, tidybayes and BayesFactor packages in R, along with JAGS (see link on resources page of website)

slide-3
SLIDE 3

Announcements

slide-4
SLIDE 4

Day 4 materials

  • Update your copy of the

chdss2019_content repository (type git pull at the terminal when working directory is Desktop/chdss2019_content) Open chdss2019_content.Rproj

slide-5
SLIDE 5

Goals

  • 1. Introduce some statistical concepts,

including Bayesian approaches and mixed effects models

  • 2. Work towards a statistical analysis
  • f the sampling

frames data

slide-6
SLIDE 6

Classical tests

slide-7
SLIDE 7

tinyframes data

slide-8
SLIDE 8

tinyframes data

slide-9
SLIDE 9

t-test

slide-10
SLIDE 10

From a t-test to linear models

mod1: mod2:

slide-11
SLIDE 11

From a t-test to linear models

mod1: mod2:

slide-12
SLIDE 12

ANOVA for model comparison

mod1: mod2:

slide-13
SLIDE 13

Least squares regression

slide-14
SLIDE 14

Coughing patient

  • d: Jen is coughing
  • h1: Jen has a cold

h2: Jen has emphysema h3: Jen has a stomach upset

Posterior probability Prior knowledge

P(h|d) = P(d|h) P(h) P(d)

Evidence (Likelihood)

slide-15
SLIDE 15

Coughing patient

  • d: Jen is coughing
  • h1: Jen has a cold

h2: Jen has emphysema h3: Jen has a stomach upset

Posterior probability Evidence (Likelihood) Prior knowledge

P(h|d) α P(d|h) P(h)

slide-16
SLIDE 16

Specifying prior and likelihood

slide-17
SLIDE 17

prior likelihood posterior

slide-18
SLIDE 18

Exercise: Coughing patient

slide-19
SLIDE 19

Bayesian inference

Two distinct applications:

  • 1. Bayesian Data analysis
  • 2. Bayesian cognitive models
slide-20
SLIDE 20

Bayesian regression

M1: M2: Both models assume Fitting M2: compute where D is the observed data

slide-21
SLIDE 21

Bayesian regression

prior likelihood posterior

slide-22
SLIDE 22

Bayesian inference

prior Assume

slide-23
SLIDE 23

Bayesian inference

likelihood

slide-24
SLIDE 24

Bayesian inference

likelihood

slide-25
SLIDE 25

Bayesian inference

likelihood …

slide-26
SLIDE 26

Bayesian inference

prior posterior

slide-27
SLIDE 27

Markov-Chain Monte Carlo (MCMC) methods

slide-28
SLIDE 28

Regression

  • Least-squares:
  • Bayesian:
slide-29
SLIDE 29

Bayes factors for model comparison

M1: M2:

slide-30
SLIDE 30

Bayes factors for model comparison

M1: M2:

slide-31
SLIDE 31

Bayes factors for model comparison

slide-32
SLIDE 32

Bayes factors for model comparison

mod1: mod2:

slide-33
SLIDE 33

Multiple predictors

slide-34
SLIDE 34

Multiple predictors

mod3: Model selection:

slide-35
SLIDE 35

Model comparison with AIC and BIC

Find that maximizes For model with parameters AIC: BIC: where k is number of parameters, n is number of data points

slide-36
SLIDE 36

Model comparison with AIC and BIC

Find that maximizes AIC: BIC: where k is number of parameters, n is number of data points Important points:

  • lower is better
  • both penalize model complexity

(BIC has heavier penalty)

slide-37
SLIDE 37

Model comparison with AIC and BIC

slide-38
SLIDE 38

Mixed effects models

  • ANOVA models used to be the go-to

approach in psychology, but the field is shifting to mixed-effects models.

  • Advantages of mixed-effects models:

– extend naturally to complex situations (e.g. cases with nested structure, factors that

  • verlap in complex ways)

– deal well with missing data

slide-39
SLIDE 39

Sleep study example

slide-40
SLIDE 40

Fixed intercept, slope

slide-41
SLIDE 41

Random intercept per group

slide-42
SLIDE 42

Random slope per group

slide-43
SLIDE 43

Random slope + intercept per group

slide-44
SLIDE 44

Mixed effects models

slide-45
SLIDE 45

Exercise

slide-46
SLIDE 46

modestframes data

slide-47
SLIDE 47

Model comparison

anova(modest1, modest2, modest3)

slide-48
SLIDE 48

Model checking: individuals

slide-49
SLIDE 49

Model checking: predictions

slide-50
SLIDE 50

Model checking: residuals

slide-51
SLIDE 51

frames data

slide-52
SLIDE 52

Model comparison

anova(linframes1, linframes2)

linframes1: linframes2:

slide-53
SLIDE 53

Model checking: individuals

slide-54
SLIDE 54

Generalized linear mixed models

Map response to generalization (between 0 and 1)

slide-55
SLIDE 55

What to write up?

  • The actual paper reported Bayes factors

computed using JASP

  • See analysis_samplesize.Rmd

(in samplingframes/analysis) for more