Publications by Michael Friendly

Generate sampling distribution of regression estimates

25.10.2020

This demonstration uses a small data set to define a context for repeated sampling from a “population” with known slope and intercept to develope the sampling distributions of regression estimates. The data relate to predicting outcome in therapy (Y) from scores on a personality test (X). We treat the X values as fixed as in the standard regr...

13193 sym R (5418 sym/29 pcs) 7 img

Linear Regression Example: Elections Economy

29.11.2020

Here I take some of the code from ElectionsEconomy/hibbs.R The original goal was just to explore using stan_glm() for fitting simple linear regression models. A couple of sidebars arose from this example. Load packages library("here") root<-here library("rstanarm") library("arm") library("ggplot2") library("bayesplot") theme_set(bayesplot:...

9987 sym R (5252 sym/31 pcs) 8 img

Logistic regression: NES 92

12.03.2021

Based on Example: modeling political preference given income Logistic regression, identifiability, and separation. See Chapters 13 and 14 in Regression and Other Stories. Load packages # library("arm") # library("foreign") library("rstanarm") library(ggplot2) library(car) library(effects) library(vcd) Set root for data files. I run this in...

6110 sym R (6424 sym/19 pcs) 7 img

Coefficient plots for linear models

16.10.2021

Coefficient plots are often more useful than tables but plotting raw coefficients can be misleading when the predictors are on different scales. The packages arm and modelsummary are used to illustrate these plots, discovering some other problems with naive use of coefficient plots. I compare plotting: raw coefficients standardized coefficients ...

9512 sym R (4814 sym/17 pcs) 6 img

Quetelet's Propensity Puzzles

17.04.2022

This is now on: https://rpubs.com/friendly/propensity In his 1831 Research on the Propensity for Crime and Different Ages, Quetelet presents the data below as Table 13 (p. 57) giving the numbers of men and women accused of crime according to age groups, and then measures of “degrees of the propensity for crime”. table13 <- read_table("https:...

11015 sym R (3497 sym/13 pcs) 6 img 1 tbl