class: center, middle, title-slide, inverse layout: false <audio controls> <source src="media/daft_punk_end_of_line.mp3" type="audio/mpeg"> <source src="media/daft_punk_end_of_line.ogg" type="audio/ogg"/> </audio> # The SPINE of statistics: the linear model, parameters and estimation ## Professor Andy Field <div> <img style="vertical-align:middle; width:30px; height:30px" src="media/twitter_60.png"> <span style="line-height:40px;">@profandyfield</span> </div> <div> <img style="vertical-align:middle; width:60px" src="media/youtube.png"> <span style="line-height:40px;">www.youtube.com/user/ProfAndyField/</span> </div> <div> <img style="vertical-align:middle; width:30px; height:30px" src="media/ds_com_fav.png"> <span style="line-height:40px;">www.discoveringstatistics.com</span> </div> <div> <img style="vertical-align:middle; width:30px; height:30px" src="media/milton_grey_fav.png"> <span style="line-height:40px;">www.milton-the-cat.rocks</span> </div> <div> <img style="vertical-align:middle; width:30px; height:30px" src="media/discovr_fav.png"> <span style="line-height:40px;">www.discovr.rocks</span> </div> ??? h or ?: Toggle the help window j: Jump to next slide k: Jump to previous slide b: Toggle blackout mode m: Toggle mirrored mode. p: Toggle PresenterMode f: Toggle Fullscreen t: Reset presentation timer <number> + <Return>: Jump to slide <number> c: Create a clone presentation on a new window --- class: center  ??? All research starts with a question, hypothesis, or something that needs to be quantified or estimated. --- class: center  ??? To test that idea you need to sample data. A key concept here is something known as the standard error. --- class: center  ??? Having collected data you need to visualise it (although we don't talk about this in lectures, the tutorials will give you practice) --- class: center  ??? You then fit a model to the data --- class: center  ??? When you fit a model there are typically two things you might be interested in. The first is estimating the effect of interest. You do this with a single value (a parameter) or a range of values (and interval) --- class: center  ??? When you fit a model there are typically two things you might be interested in. The second is to test hypotheses about the parameters (usually whether they are different to 0) --- class: center  ??? Having fit a model you want to test whether it is biased. --- class: center  ??? If it is biased you would want to fit one of a class of alternative models robust to these biases. --- # The SPINE of statistics ## 5 Key concepts * **S**tandard error * **P**arameters * **I**nterval estimates * **N**ull hypothesis significance testing (NHST) * **E**stimation --- class: center  ??? Today we're going to look at the model we typically fit - the linear model - and look at how parameters are estimated (very broadly) --- # Learning outcomes -- * Understand the commonalities in psychological statistical models + Most psychological statistical boil down to a very simple idea of predicting an outcome from one or more measured variables -- * Understand the function and form of the linear model + Predicting an outcome variable from another variable (a predictor) + The mathematical model + Visualizing the model + Familiar models as variants of the linear model -- * Understand what the model parameters (*b*s) represent -- * Understand why we use sampling -- * Understand (conceptually) least squares estimation --- class: center, middle, title-slide, inverse layout: false ## Why do (some) students hate statistics? --- background-image: none background-color: #000000 <video width="100%" height="100%" controls id="my_video"> <source src="media/dw_42_clip.mp4" type="video/mp4"> </video> --- class: center, middle -- .eq_lrge[ .ong_dk[ <p style="position:absolute; left: 10%; top: 15%;"> $$ Y_i = \hat{b}_0 + \hat{b}_1\text{X}_{i} + \text{e}_i $$ </p> ]] -- .eq_lrge[ .ong_dk[ <p style="position:absolute; left: 55%; top: 15%;"> $$ r = \frac{\sum\limits_{i = 1}^n(x_i-\bar{X})(y_i-\bar{Y})}{(N-1)s_xs_y} $$ </p> ]] -- .eq_lrge[ .ong_dk[ <p style="position:absolute; left: 10%; top: 55%;"> $$ t = \frac{\bar{X}_1-\bar{X}_2}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}} $$ </p> ]] -- .eq_lrge[ .ong_dk[ <p style="position:absolute; left: 55%; top: 55%;"> $$ \chi^2 = \sum\frac{(\text{observed}_{ij}-\text{model}_{ij})^2}{\text{model}_{ij}} $$ </p> ]] --- class: center, middle, title-slide, inverse layout: false ## Can we make statistics (a bit) less like this? --- <video width="100%" height="100%" controls id="my_video"> <source src="media/andy_dungeon_scream.mp4" type="video/mp4"> </video> --- layout: true background-image: url("media/ais_ppt_hex_white.jpg") background-size: cover --- # The only equation you will ever need ## The General Linear Model (GLM) -- .ong_dk[ $$ `\begin{aligned} \text{outcome}_i &= (\text{model}_i) + \text{error}_i \\ \text{outcome}_i &= \hat{b}_0 + \hat{b}_1\text{predictor}_{i} + \dots + \text{error}_i \end{aligned}` $$ ] --- background-image: url("media/andy_zombie.jpg") background-size: cover # .bwn[A zombie quiz] --- # A zombie quiz > A researcher counted how many humans and zombies choose brain chips or potato chips to accompany their dinner at the university canteen -- * How do I analyze these data? <table class="table table-striped" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Organism </th> <th style="text-align:right;"> Brain chips </th> <th style="text-align:right;"> Potato chips </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Human </td> <td style="text-align:right;"> 28 </td> <td style="text-align:right;"> 42 </td> </tr> <tr> <td style="text-align:left;"> Zombie </td> <td style="text-align:right;"> 61 </td> <td style="text-align:right;"> 57 </td> </tr> </tbody> </table> --- # A chi-square test ```r chisq.test(zom_fct_tib$organism, zom_fct_tib$chip, correct = FALSE) ``` ``` ## ## Pearson's Chi-squared test ## ## data: zom_fct_tib$organism and zom_fct_tib$chip *## X-squared = 2.4105, df = 1, p-value = 0.1205 ``` --- # A Spearman correlation? -- ```r zom_tib |> correlation::correlation(method = "spearman") ``` <table class="table table-striped" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Parameter1 </th> <th style="text-align:left;"> Parameter2 </th> <th style="text-align:right;"> rho </th> <th style="text-align:right;"> CI </th> <th style="text-align:right;"> CI_low </th> <th style="text-align:right;"> CI_high </th> <th style="text-align:right;"> S </th> <th style="text-align:right;"> p </th> <th style="text-align:left;"> Method </th> <th style="text-align:right;"> n_Obs </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> organism </td> <td style="text-align:left;"> chip </td> <td style="text-align:right;"> -0.113 </td> <td style="text-align:right;"> 0.95 </td> <td style="text-align:right;"> -0.256 </td> <td style="text-align:right;"> 0.035 </td> <td style="text-align:right;"> 1232810 </td> <td style="text-align:right;background-color: yellow !important;"> 0.122 </td> <td style="text-align:left;"> Spearman correlation </td> <td style="text-align:right;"> 188 </td> </tr> </tbody> </table> --- # A Kendall's `\(\tau\)` correlation? -- ```r zom_tib |> correlation::correlation(method = "kendall") ``` <table class="table table-striped" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Parameter1 </th> <th style="text-align:left;"> Parameter2 </th> <th style="text-align:right;"> tau </th> <th style="text-align:right;"> CI </th> <th style="text-align:right;"> CI_low </th> <th style="text-align:right;"> CI_high </th> <th style="text-align:right;"> z </th> <th style="text-align:right;"> p </th> <th style="text-align:left;"> Method </th> <th style="text-align:right;"> n_Obs </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> organism </td> <td style="text-align:left;"> chip </td> <td style="text-align:right;"> -0.113 </td> <td style="text-align:right;"> 0.95 </td> <td style="text-align:right;"> -0.206 </td> <td style="text-align:right;"> -0.018 </td> <td style="text-align:right;"> -1.548 </td> <td style="text-align:right;background-color: yellow !important;"> 0.122 </td> <td style="text-align:left;"> Kendall correlation </td> <td style="text-align:right;"> 188 </td> </tr> </tbody> </table> --- # A Pearson correlation? -- ```r zom_tib |> correlation::correlation() ``` <table class="table table-striped" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Parameter1 </th> <th style="text-align:left;"> Parameter2 </th> <th style="text-align:right;"> r </th> <th style="text-align:right;"> CI </th> <th style="text-align:right;"> CI_low </th> <th style="text-align:right;"> CI_high </th> <th style="text-align:right;"> t </th> <th style="text-align:right;"> df_error </th> <th style="text-align:right;"> p </th> <th style="text-align:left;"> Method </th> <th style="text-align:right;"> n_Obs </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> organism </td> <td style="text-align:left;"> chip </td> <td style="text-align:right;"> -0.113 </td> <td style="text-align:right;"> 0.95 </td> <td style="text-align:right;"> -0.252 </td> <td style="text-align:right;"> 0.03 </td> <td style="text-align:right;"> -1.554 </td> <td style="text-align:right;"> 186 </td> <td style="text-align:right;background-color: yellow !important;"> 0.122 </td> <td style="text-align:left;"> Pearson correlation </td> <td style="text-align:right;"> 188 </td> </tr> </tbody> </table> --- # A *t*-test? -- ```r brains <- zom_tib |> dplyr::filter(chip == 0) potatoes <- zom_tib |> dplyr::filter(chip == 1) ``` ```r t.test(brains$organism, potatoes$organism) ``` <table class="table table-striped" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:right;"> estimate </th> <th style="text-align:right;"> estimate1 </th> <th style="text-align:right;"> estimate2 </th> <th style="text-align:right;"> statistic </th> <th style="text-align:right;"> p.value </th> <th style="text-align:right;"> parameter </th> <th style="text-align:right;"> conf.low </th> <th style="text-align:right;"> conf.high </th> <th style="text-align:left;"> method </th> <th style="text-align:left;"> alternative </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0.11 </td> <td style="text-align:right;"> 0.685 </td> <td style="text-align:right;"> 0.576 </td> <td style="text-align:right;"> 1.559 </td> <td style="text-align:right;background-color: yellow !important;"> 0.121 </td> <td style="text-align:right;"> 185.619 </td> <td style="text-align:right;"> -0.029 </td> <td style="text-align:right;"> 0.248 </td> <td style="text-align:left;"> Welch Two Sample t-test </td> <td style="text-align:left;"> two.sided </td> </tr> </tbody> </table> --- # One-way ANOVA? -- ```r zom_tib |> aov(organism ~ factor(chip), data = _) ``` <table> <thead> <tr> <th style="text-align:left;"> term </th> <th style="text-align:right;"> df </th> <th style="text-align:right;"> sumsq </th> <th style="text-align:right;"> meansq </th> <th style="text-align:right;"> statistic </th> <th style="text-align:right;"> p.value </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> factor(chip) </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.563 </td> <td style="text-align:right;"> 0.563 </td> <td style="text-align:right;"> 2.416 </td> <td style="text-align:right;background-color: yellow !important;"> 0.122 </td> </tr> <tr> <td style="text-align:left;background-color: white !important;"> Residuals </td> <td style="text-align:right;background-color: white !important;"> 186 </td> <td style="text-align:right;background-color: white !important;"> 43.373 </td> <td style="text-align:right;background-color: white !important;"> 0.233 </td> <td style="text-align:right;background-color: white !important;"> NA </td> <td style="text-align:right;background-color: yellow !important;background-color: white !important;"> NA </td> </tr> </tbody> </table> --- # Linear model (Regression)? -- ```r zom_tib |> lm(organism ~ factor(chip), data = _) ``` <table> <thead> <tr> <th style="text-align:left;"> term </th> <th style="text-align:right;"> estimate </th> <th style="text-align:right;"> std.error </th> <th style="text-align:right;"> statistic </th> <th style="text-align:right;"> p.value </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;background-color: white !important;"> (Intercept) </td> <td style="text-align:right;background-color: white !important;"> 0.685 </td> <td style="text-align:right;background-color: white !important;"> 0.051 </td> <td style="text-align:right;background-color: white !important;"> 13.390 </td> <td style="text-align:right;background-color: yellow !important;background-color: white !important;"> 0.000 </td> </tr> <tr> <td style="text-align:left;"> factor(chip)1 </td> <td style="text-align:right;"> -0.110 </td> <td style="text-align:right;"> 0.071 </td> <td style="text-align:right;"> -1.554 </td> <td style="text-align:right;background-color: yellow !important;"> 0.122 </td> </tr> </tbody> </table> --- # Loglinear model? -- ```r xtabs(~ organism + chip, data = zom_fct_tib) |> MASS::loglm(~ organism + chip, data = _) ``` <table> <thead> <tr> <th style="text-align:right;"> X^2 </th> <th style="text-align:right;"> df </th> <th style="text-align:right;"> P(> X^2) </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;background-color: white !important;"> 2.422 </td> <td style="text-align:right;background-color: white !important;"> 1 </td> <td style="text-align:right;background-color: yellow !important;background-color: white !important;"> 0.120 </td> </tr> <tr> <td style="text-align:right;"> 2.410 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;background-color: yellow !important;"> 0.121 </td> </tr> </tbody> </table> --- # Multilevel model? -- ```r lmerTest::lmer(chip ~ organism + (1|canteen), data = zom_tib) ``` <table> <thead> <tr> <th style="text-align:left;"> Parameter </th> <th style="text-align:right;"> Coefficient </th> <th style="text-align:right;"> SE </th> <th style="text-align:right;"> CI </th> <th style="text-align:right;"> CI_low </th> <th style="text-align:right;"> CI_high </th> <th style="text-align:right;"> t </th> <th style="text-align:right;"> df_error </th> <th style="text-align:right;"> p </th> <th style="text-align:left;"> Effects </th> <th style="text-align:left;"> Group </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;background-color: white !important;"> (Intercept) </td> <td style="text-align:right;background-color: white !important;"> 0.600 </td> <td style="text-align:right;background-color: white !important;"> 0.060 </td> <td style="text-align:right;background-color: white !important;"> 0.95 </td> <td style="text-align:right;background-color: white !important;"> 0.482 </td> <td style="text-align:right;background-color: white !important;"> 0.718 </td> <td style="text-align:right;background-color: white !important;"> 10.065 </td> <td style="text-align:right;background-color: white !important;"> 184 </td> <td style="text-align:right;background-color: yellow !important;background-color: white !important;"> 0.000 </td> <td style="text-align:left;background-color: white !important;"> fixed </td> <td style="text-align:left;background-color: white !important;"> </td> </tr> <tr> <td style="text-align:left;"> organism </td> <td style="text-align:right;"> -0.117 </td> <td style="text-align:right;"> 0.075 </td> <td style="text-align:right;"> 0.95 </td> <td style="text-align:right;"> -0.265 </td> <td style="text-align:right;"> 0.032 </td> <td style="text-align:right;"> -1.554 </td> <td style="text-align:right;"> 184 </td> <td style="text-align:right;background-color: yellow !important;"> 0.122 </td> <td style="text-align:left;"> fixed </td> <td style="text-align:left;"> </td> </tr> <tr> <td style="text-align:left;"> SD (Intercept) </td> <td style="text-align:right;"> 0.000 </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> 0.95 </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;background-color: yellow !important;"> NA </td> <td style="text-align:left;"> random </td> <td style="text-align:left;"> canteen </td> </tr> <tr> <td style="text-align:left;"> SD (Observations) </td> <td style="text-align:right;"> 0.499 </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> 0.95 </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;"> NA </td> <td style="text-align:right;background-color: yellow !important;"> NA </td> <td style="text-align:left;"> random </td> <td style="text-align:left;"> Residual </td> </tr> </tbody> </table> --- .center[  ] --- .center[  ] --- # The only equation you will ever need ## The General Linear Model (GLM) -- .ong_dk[ $$ `\begin{aligned} \text{outcome}_i &= (\text{model}_i) + \text{error}_i \\ \text{outcome}_i &= \hat{b}_0 + \hat{b}_1\text{predictor}_{i} + \dots + \hat{b}_n\text{predictor}_{i} + \text{error}_i \end{aligned}` $$ ] -- `\(\hat{b}_n\)` * Estimate of parameter for a predictor + Direction/strength of relationship/effect + Difference in means -- `\(\hat{b}_0\)` * Estimate of the value of the outcome when predictor(s) = 0 (intercept) --- .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{volume}_{i} + e_i \end{aligned}` $$ ] -- .pull-left[  ] .pull-right[  ] --- class: center .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{volume}_{i} + e_i \end{aligned}` $$ ] -- .pull-left[ <!-- --> ] --- class: center .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{volume}_{i} + e_i \end{aligned}` $$ ] .pull-left[ <!-- --> ] ??? Let's zoom out of the plot a bit --- class: center .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{volume}_{i} + e_i \end{aligned}` $$ ] .pull-left[ <!-- --> ] .pull-right[ <!-- --> ] --- class: center .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{volume}_{i} + e_i \end{aligned}` $$ ] .pull-left[ <!-- --> ] .pull-right[ <!-- --> ] --- class: center .ong_dk[ $$ `\begin{aligned} \hat{\text{ringing}}_i &= -37.12 + 10.45\text{volume}_{i} \end{aligned}` $$ ] .pull-left[ <!-- --> ] .pull-right[ <!-- --> ] ??? Note that the intercept is a value that extrapolates well beyond the data. We might want to take it with a pinch of salt. The intercept is -37.12. That makes no sense - your ears can't ring for a minus amount of time. You'd expect the value to be zero in the population (0 db = 0 ringing). Illustrates that estimates are not accurate. Also, is it reasonable to assume a linear relationship here? Isn't it more likely that a range of low volumes ringing will be zero hours, and at a certain threshold ringing kicks in. It is almost certainly not linear along the whole range of volumes. --- class: center .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{musician}_{i} + e_i \end{aligned}` $$ ] -- <!-- --> --- class: center .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{musician}_{i} + e_i \end{aligned}` $$ ] <!-- --> --- class: center .ong_dk[ $$ `\begin{aligned} \text{ringing}_i &= \hat{b}_0 + \hat{b}_1\text{musician}_{i} + e_i \end{aligned}` $$ ] <!-- --> --- class: middle, centre  -- .ong[ <p style="position:absolute; left: 70%; top: 5%;"> $$ \text{outcome} = \text{model} + \text{error}_i $$ </p> ] -- .ong[ <p style="position:absolute; left: 3%; top: 80%;"> $$ \text{outcome} = \text{estimated model} + \text{error}_i $$ </p> ] --- background-image: none background-color: #000000 <video width="100%" height="100%" controls id="my_video"> <source src="media/bridge_01.mp4" type="video/mp4"> </video> --- background-image: none background-color: #000000 <video width="100%" height="100%" controls id="my_video"> <source src="media/bridge_water.mp4" type="video/mp4"> </video> --- background-image: none background-color: #000000 <video width="100%" height="100%" controls id="my_video"> <source src="media/bridge_wind.mp4" type="video/mp4"> </video> --- background-image: none background-color: #000000 <video width="100%" height="100%" controls id="my_video"> <source src="media/bridge_hippo.mp4" type="video/mp4"> </video> --- --- class: center, middle  --- class: center, middle  --- class: center, middle  --- # Ordinary least squares (OLS) estimation .ong_dk[ $$ \text{friends}_i = \hat{b}_0 + e_i $$ ] .pull-left[ * With no predictors, we predict an outcome from only the intercept `\(\hat{b}_0\)` * In this scenario `\(\hat{b}_0\)` will be the mean value of the outcome * The model has one predicted value (the mean) for all observations * Data: .blu[1, 3, 4, 3, 2] ] .pull-right[  ] --- ## Guess 1: `\(\hat{b}_0\)` = 2 .ong_dk[ $$ `\begin{aligned} \text{friends}_i &= \hat{b}_0 + \text{error}_i \\ \text{error}_i &= \text{friends}_i - \hat{b}_0 \end{aligned}` $$ ] .pull-left[
Friends (Y)
Estimate
Error
Squared error
1
2
2
2
3
2
3
2
4
2
] .pull-right[ <!-- --> ] --- ## Guess 1: `\(\hat{b}_0\)` = 2 .ong_dk[ $$ `\begin{aligned} \text{friends}_i &= \hat{b}_0 + \text{error}_i \\ \text{error}_i &= \text{friends}_i - \hat{b}_0 \end{aligned}` $$ ] .pull-left[
Friends (Y)
Estimate
Error
Squared error
1
2
-1
1
2
2
0
0
3
2
1
1
3
2
1
1
4
2
2
4
Total
—
—
—
7
] .pull-right[ <!-- --> ] --- ## Guess 2: `\(\hat{b}_0\)` = 4 .ong_dk[ $$ `\begin{aligned} \text{friends}_i &= \hat{b}_0 + \text{error}_i \\ \text{error}_i &= \text{friends}_i - \hat{b}_0 \end{aligned}` $$ ] .pull-left[
Friends (Y)
Estimate
Error
Squared error
1
4
2
4
3
4
3
4
4
4
] .pull-right[ <!-- --> ] --- ## Guess 2: `\(\hat{b}_0\)` = 4 .ong_dk[ $$ `\begin{aligned} \text{friends}_i &= \hat{b}_0 + \text{error}_i \\ \text{error}_i &= \text{friends}_i - \hat{b}_0 \end{aligned}` $$ ] .pull-left[
Friends (Y)
Estimate
Error
Squared error
1
4
-3
9
2
4
-2
4
3
4
-1
1
3
4
-1
1
4
4
0
0
Total
—
—
—
15
] .pull-right[ <!-- --> ] --- class: center  --- class: center <!-- --> --- class: center <!-- --> --- class: center <!-- --> --- ## OLS estimate: `\(\hat{b}_0\)` = 2.6 .ong_dk[ $$ `\begin{aligned} \text{friends}_i &= \hat{b}_0 + \text{error}_i \\ \text{error}_i &= \text{friends}_i - \hat{b}_0 \end{aligned}` $$ ] .pull-left[
Friends (Y)
Estimate
Error
Squared error
1
2.6
-1.6
2.56
2
2.6
-0.6
0.36
3
2.6
0.4
0.16
3
2.6
0.4
0.16
4
2.6
1.4
1.96
Total
—
—
—
5.2
] .pull-right[ <!-- --> ] --- * Data: 1, 3, 4, 3, 2 .ong_dk[ $$ \hat{\text{friends}} = \frac{\sum\limits^n_{i = 1}x_i}{n} $$ ] -- * Add up the scores .ong_dk[ $$ `\begin{aligned} \sum\limits^n_{i = 1}x_i &= 1+3+4+3+2 \\ &= 13 \end{aligned}` $$ ] -- * Divide by the number of scores, *n* .ong_dk[ $$ `\begin{aligned} \frac{\sum\limits^n_{i = 1}x_i}{n} &= \frac{13}{5} \\ &= 2.6 \end{aligned}` $$ ] --- # Summary * People try to make statistics seem complicated but boils down to simple ideas: - We predict one variable from a model containing one or more predictors - There is always error in prediction - The model you fit represents hypotheses - The model you fit is typically a variation on the the linear model (GLM) - If you understand this one model, you understand most of psychological statistics -- * Parameter estimates (*b*) - Tell us about the shape of the model - Tell us about size and direction of relationship between predictor(s) and outcome - They are estimated from the sample data -- * Estimation - Ordinary least squares (OLS) estimation is one (of many) methods for estimating parameters - The mean is an example of an OLS estimator