This study examines how inflation(CPI) and corruption affect national happiness. Hamja et al. (2025) found higher inflation lowers happiness, while Ma et al. (2022) showed that corruption reduces life satisfaction.
Hamja et Al. (2025) conductued a study analyzing the impact of economic factors inclusing the Consumer Price Index (CPI), on national happiness during a global pandemic. Using advanced machine learning techniques, they found that higher CPI values, indicating increased inflation and cost of living, were significantly associated with lower happiness scores across countries.
Summarize the empirical article you selected. Discuss the key findings.
State your directional hypothesis. Specify the expected relationship between your variables. This section should be clear and concise. You need one hypothesis for IV1, one hypothesis for IV2, and one hypothesis for a predicted interaction. If you are running a logistic regression, you do not need a hypothesis for an interaction.
Describe the sample used in your study. Include details about the population, sample size, and any relevant demographic information.
List your independent and dependent variables. Explain how each variable was operationalized, including the range for continuous variables and levels for categorical variables.
# Load necessary libraries
library(ggplot2)
library(dplyr)
library(psych)
library(knitr)
library(readxl)
# Load your dataset in this chunk
library(readxl)
world_happiness_2 <- read_excel("Downloads/world happiness 2.xlsx")
## Error: `path` does not exist: 'Downloads/world happiness 2.xlsx'
## Error: object 'world_happiness_2' not found
Present the descriptive statistics for your variables. Include appropriate measures of central tendency (mean, median), variability (standard deviation, range), and frequency distributions where applicable. Use R code chunks to generate and display your results.
## vars n mean sd median trimmed mad min max range skew
## Sepal.Length 1 150 5.84 0.83 5.80 5.81 1.04 4.3 7.9 3.6 0.31
## Sepal.Width 2 150 3.06 0.44 3.00 3.04 0.44 2.0 4.4 2.4 0.31
## Petal.Length 3 150 3.76 1.77 4.35 3.76 1.85 1.0 6.9 5.9 -0.27
## Petal.Width 4 150 1.20 0.76 1.30 1.18 1.04 0.1 2.5 2.4 -0.10
## Species* 5 150 2.00 0.82 2.00 2.00 1.48 1.0 3.0 2.0 0.00
## kurtosis se
## Sepal.Length -0.61 0.07
## Sepal.Width 0.14 0.04
## Petal.Length -1.42 0.14
## Petal.Width -1.36 0.06
## Species* -1.52 0.07
Perform your chosen analysis. Make sure your output shows.
# Linear regression: Predict Petal Length using Sepal Width and Sepal Length
model <- lm(Petal.Length ~ Sepal.Width + Sepal.Length, data = iris)
summary(model)
##
## Call:
## lm(formula = Petal.Length ~ Sepal.Width + Sepal.Length, data = iris)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.25582 -0.46922 -0.05741 0.45530 1.75599
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.52476 0.56344 -4.481 1.48e-05 ***
## Sepal.Width -1.33862 0.12236 -10.940 < 2e-16 ***
## Sepal.Length 1.77559 0.06441 27.569 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6465 on 147 degrees of freedom
## Multiple R-squared: 0.8677, Adjusted R-squared: 0.8659
## F-statistic: 482 on 2 and 147 DF, p-value: < 2.2e-16
Run a post-hoc power analysis with the pwr
package. Use
the pwr.f2.test
function for multiple regression power
analysis.
Results are interpreted clearly using APA style; connection to hypothesis is made; statistical significance and practical implications are addressed; power level is addressed.
Include at least one table and one graph that effectively summarize your analysis and findings. Use R code chunks to generate these visualizations.
#Example R code for creating a graph
# You will be performing a median split
# Median split for Experience to visualize the linear x linear interaction
iris <- iris %>%
mutate(Sepal_Length_Split = ifelse(Sepal.Length > median(Sepal.Length), "Long Sepals", "Short Sepals"))
# Plot the interaction using the median split
ggplot(iris, aes(x = Sepal.Width, y = Petal.Length, color = Sepal_Length_Split)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "Effect of Sepal Width on Petal Length by Sepal Length (Median Split)",
x = "Sepal Width", y = "Petal Length") +
scale_color_manual(values = c("Long Sepals" = "green", "Short Sepals" = "orange")) +
theme_apa()
# Example R code for creating a table
# Create a summary table by Species
summary_table <- iris %>%
group_by(Sepal_Length_Split) %>%
dplyr::summarise(
Petal.Length.Mean = mean(Petal.Length),
Petal.Length.SD = sd(Petal.Length),
Petal.Length.Min = min(Petal.Length),
Petal.Length.Max = max(Petal.Length)
)
# Display the table using knitr::kable()
kable(summary_table, caption = "Descriptive Statistics for Iris Sepal Length")
Sepal_Length_Split | Petal.Length.Mean | Petal.Length.SD | Petal.Length.Min | Petal.Length.Max |
---|---|---|---|---|
Long Sepals | 5.238571 | 0.6876325 | 4 | 6.9 |
Short Sepals | 2.462500 | 1.3500469 | 1 | 5.1 |
Discuss the implications of your results for psychological theory or practice. Address the following points:
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum.
List the articles you reviewed in APA format. Do not worry about the indentations.