Presentation is loading. Please wait.

Presentation is loading. Please wait.

DCAL Stats Workshop Bodo Winter.

Similar presentations


Presentation on theme: "DCAL Stats Workshop Bodo Winter."— Presentation transcript:

1 DCAL Stats Workshop Bodo Winter

2 What if your response is not continuous?
General Linear Model Generalized Linear Model Poisson regression logistic regression

3 Background: logarithms
Logarithms transform a numbers into magnitudes Example: transforming a number by the log10 function log10(1) = 0 log10(10) = 1 log10(100) = 2 log10(1000) = 3

4 Background: logarithms
The exponential function is the inverse of the logarithmic function log10(1) = 0 log10(10) = 1 log10(100) = 2 log10(1000) = 3

5 Background: Logarithms of decimals
log10(0.1) = -1 log10(0.01) = -2 log10(0.001) = -3

6 Background: logarithms
The exponential function is the inverse of the logarithmic function log10(1) = = 0 log10(10) = = 1 log10(100) = = 100 log10(1000) = = 1000

7 Logarithms: a visual example

8 Logarithms: a visual example

9 In R: log(x) exp(x)

10 What if your response is not continuous?
General Linear Model Generalized Linear Model Poisson regression logistic regression

11 Generalized Linear Models: Three Ingredients
Assumed probability distribution of the response: normal (“Gaussian”), Poisson, binomial A linear predictor (LP) = “just a new name for your regression equation” A link function (identity, log, logit)

12 Three common GLMs (and their link functions)
𝑔 𝜇 =𝜇 Linear regression 𝑔 𝜇 =log⁡(𝜇) Poisson regression 𝑔 𝜇 =log⁡( 𝜇 1−𝜇 ) Logistic regression

13 The Poisson distribution

14 Example where I used Poisson regression
Winter, B. & Ardell, D. (in prep.). Rethinking Zipf’s frequency-meaning relationship: The role of contextual diversity.

15 Another example: Bentz & Winter (2013)
Bentz, C., & Winter, B. (2013). Languages with more second language learners tend to lose nominal case. Language Dynamics & Change, 3:1, 1-27.

16 Example: modeling speech errors

17 Example: modeling speech errors, linear model

18 Example: modeling speech errors, Poisson model

19 Poisson model in R xmdl <- glm(error ~ alcohol, data = xdata, family = ‘poisson’) Estimate (Intercept) alcohol

20 Poisson model in R xmdl <- glm(error ~ alcohol, data = xdata, family = ‘poisson’) Estimate (Intercept) alcohol log coefficients

21 Poisson model in R xmdl <- glm(error ~ alcohol, data = xdata, family = ‘poisson’) Estimate (Intercept) alcohol log coefficients example: What do we predict for alcohol = 2? * 2 = 0.8 (logged value)

22 Poisson model in R xmdl <- glm(error ~ alcohol, data = xdata, family = ‘poisson’) Estimate (Intercept) alcohol log coefficients example: What do we predict for alcohol = 2? * 2 = 0.8 (logged value) exp(0.8) = 2.2

23 What if your response is not continuous?
General Linear Model Generalized Linear Model Poisson regression logistic regression

24 Logistic regression with speech errors (yes / no)

25 Logistic regression with speech errors (yes / no)

26 Logistic regression with speech errors (yes / no)

27 Logistic regression with speech errors (yes / no)

28 Odds and log odds examples
Probability Odds Log odds (= “logits”) 0.1 0.111 -2.197 0.2 0.25 -1.386 0.3 0.428 -0.847 0.4 0.667 -0.405 0.5 1 0.6 1.5 0.405 0.7 2.33 0.847 0.8 4 1.386 0.9 9 2.197 - So a probability of 80% of an event occurring means that the odds are “4 to 1” for it occurring What happens if the odds are 50 to 50? -> ratio is 1 If the probability of non-occurrence is higher than occurrence, fractions If the probability of occurrence is higher, positive numbers

29 Logistic function

30 for probabilities: transform the entire LP with the logistic function
Estimate Std. Error z value Pr(>|z|) (Intercept) ** alc *** for probabilities: transform the entire LP with the logistic function plogis()

31 Exercise I + II Poisson model: Nettle (1999)
Gesture data (height versus shape) from Hassemer & Winter (2016)

32 Hassemer & Winter (2016) Shape Height

33


Download ppt "DCAL Stats Workshop Bodo Winter."

Similar presentations


Ads by Google