The eaboration Likleihood model suggests that enduring attitude change depends upon time spent processing information-rich, high-quality persuasive arguments. In this experiment the dependent variable, “Favor_1”, measures whether a research participant favored (1) or opposed (0) legalizing recreational marijuana, while the independent variable “Time”, measures how many seconds the participant spent looking at the information-rich, high-quality persuasive arguments in support of legalizing recreational marijuana.
Based on ELM, I hypothesized that the odds of supporting marijuana legalization will increase significantly as time spent on reading supporting arguments increases.
In this analysis the dependent variable is “Favor_1,” while the independent variable is “Time.” Because the dependent variable is categorical with two categories and the independent variable is continuous, logistic regression is a suitable statistical test of the hypothesis.
The analysis found that odds of favoring legalization of recreational marijuana increased significantly ( z= 4.8, p< .05), supporting the hypothesis.
# Installing required packages
if (!require("tidyverse"))
install.packages("tidyverse")
## Loading required package: tidyverse
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
# Read the data
mydata <- read.csv("ELM.csv") #Edit YOURFILENAME.csv
# Specify the DV and IV
mydata$DV <- mydata$Favor_1 #Edit YOURDVNAME
mydata$IV <- mydata$Time #Edit YOURIVNAME
# Look at the DV and IV
ggplot(mydata, aes(x = DV)) + geom_bar(color = "black", fill = "#1f78b4")
ggplot(mydata, aes(x = IV)) + geom_histogram(color = "black", fill = "#1f78b4")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(mydata$IV)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 30.0 153.8 230.0 230.8 300.0 450.0
# Logistic regression plot
ggplot(mydata, aes(x = IV,
y = DV))+
geom_jitter(height = .03,
alpha = .5) +
geom_smooth(method = "glm",
method.args = list(family = "binomial"),
se = FALSE,
color = "#1f78b4")
## `geom_smooth()` using formula = 'y ~ x'
# Run the logistic regression and view the summary results
options(scipen = 999)
log.ed <- glm(DV ~ IV, data = mydata, family = "binomial")
summary(log.ed)
##
## Call:
## glm(formula = DV ~ IV, family = "binomial", data = mydata)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.567169 0.920675 -4.961 0.000000702 ***
## IV 0.016209 0.003383 4.791 0.000001661 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 131.791 on 99 degrees of freedom
## Residual deviance: 94.123 on 98 degrees of freedom
## AIC: 98.123
##
## Number of Fisher Scoring iterations: 5
p <- .50
Inflection_point <- (log(p/(1-p))-coef(log.ed)[1])/coef(log.ed)[2]
Inflection_point
## (Intercept)
## 281.7672