Distance Score and Alzheimer’s Score
dat <- tribble(~participant, ~distance, ~alzheimers,
1, 2, 7,
2, 8, 20,
3, 10, 23,
4, 8, 19,
5, 4, 15,
6, 7, 14,
7, 5, 10,
8, 4, 12)
Scatterplot
dat %>%
ggplot(aes(x = distance, y = alzheimers)) +
geom_point() +
geom_smooth() +
theme_classic() +
labs(title = "Peanut Butter Smell Test & Alzheimer's Screening Scores",
x = "Distance",
y = "Alzheimer's Screening Score")
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Descriptives
dat %>%
summarise(x_mean = mean(distance),
x_sd = round(sd(distance), 2),
y_mean = mean(alzheimers),
y_sd = round(sd(alzheimers), 2))
## # A tibble: 1 × 4
## x_mean x_sd y_mean y_sd
## <dbl> <dbl> <dbl> <dbl>
## 1 6 2.67 15 5.4
Assumptions
#linearity
model <- lm(distance ~ alzheimers, data = dat)
plot(lm(distance ~ alzheimers, data = dat), which = 1)

#normality
plot(lm(distance ~ alzheimers, data = dat), which = 2)

Correlation
corr <- correlation(data = dat,
select = "distance",
select2 = "alzheimers",
method = "Pearson",
alternative = "two.sided")
corr
## # Correlation Matrix (Pearson-method)
##
## Parameter1 | Parameter2 | r | 95% CI | t(6) | p
## --------------------------------------------------------------
## distance | alzheimers | 0.91 | [0.58, 0.98] | 5.41 | 0.002**
##
## p-value adjustment method: Holm (1979)
## Observations: 8
APA Table
dat %>%
select(-participant) %>%
apa.cor.table(filename = "assignment2_correlation.doc")
##
##
## Means, standard deviations, and correlations with confidence intervals
##
##
## Variable M SD 1
## 1. distance 6.00 2.67
##
## 2. alzheimers 15.00 5.40 .91**
## [.58, .98]
##
##
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations
## that could have caused the sample correlation (Cumming, 2014).
## * indicates p < .05. ** indicates p < .01.
##
summary(model)
##
## Call:
## lm(formula = distance ~ alzheimers, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.00000 -0.45588 -0.02941 0.60784 1.45098
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.76471 1.31969 -0.579 0.58337
## alzheimers 0.45098 0.08338 5.409 0.00165 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.191 on 6 degrees of freedom
## Multiple R-squared: 0.8298, Adjusted R-squared: 0.8014
## F-statistic: 29.25 on 1 and 6 DF, p-value: 0.00165
library(report)
report(model)
## We fitted a linear model (estimated using OLS) to predict distance with
## alzheimers (formula: distance ~ alzheimers). The model explains a statistically
## significant and substantial proportion of variance (R2 = 0.83, F(1, 6) = 29.25,
## p = 0.002, adj. R2 = 0.80). The model's intercept, corresponding to alzheimers
## = 0, is at -0.76 (95% CI [-3.99, 2.46], t(6) = -0.58, p = 0.583). Within this
## model:
##
## - The effect of alzheimers is statistically significant and positive (beta =
## 0.45, 95% CI [0.25, 0.66], t(6) = 5.41, p = 0.002; Std. beta = 0.91, 95% CI
## [0.50, 1.32])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
Regression
model <- lm(distance ~ alzheimers, data = dat)
plot(model, which = 1)

plot(model, which = 2)

plot(model, which = 3)

summary(model)
##
## Call:
## lm(formula = distance ~ alzheimers, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.00000 -0.45588 -0.02941 0.60784 1.45098
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.76471 1.31969 -0.579 0.58337
## alzheimers 0.45098 0.08338 5.409 0.00165 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.191 on 6 degrees of freedom
## Multiple R-squared: 0.8298, Adjusted R-squared: 0.8014
## F-statistic: 29.25 on 1 and 6 DF, p-value: 0.00165
report(model)
## We fitted a linear model (estimated using OLS) to predict distance with
## alzheimers (formula: distance ~ alzheimers). The model explains a statistically
## significant and substantial proportion of variance (R2 = 0.83, F(1, 6) = 29.25,
## p = 0.002, adj. R2 = 0.80). The model's intercept, corresponding to alzheimers
## = 0, is at -0.76 (95% CI [-3.99, 2.46], t(6) = -0.58, p = 0.583). Within this
## model:
##
## - The effect of alzheimers is statistically significant and positive (beta =
## 0.45, 95% CI [0.25, 0.66], t(6) = 5.41, p = 0.002; Std. beta = 0.91, 95% CI
## [0.50, 1.32])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.