Skip to main content

Statistical Analysis and Modeling in R Study Guide

This guide provides R code and explanations for essential statistical analyses in quantitative research. Learn to understand measurement levels, inspect data, calculate descriptive statistics, perform reliability analysis for scale construction, and interpret correlations. This resource is suitable for researchers and students looking to enhance their data analysis skills in R.

Save this study guide to your study set

Sign up free

Your learning path

R Code for Statistical Analysis and Modeling

R Code for Factor Analysis

This guide covers R code for factor analysis, including data inspection, checking correlations, and determining the number of factors using Kaiser’s criterion and scree plots.

  • factor analysis
  • R code
  • measurement levels
  • nominal
  • interval/ratio
  • univariate descriptives
  • bivariate descriptives
  • correlation table
  • scree plot
  • Kaiser’s criterion
  • eigenvalues
  • Principal Axis Factoring
  • reliability analysis

R Code for Controlling Confounding Variables

This lecture provides R code for linear regression analysis, including data inspection, variable modification, and interpreting regression coefficients.

  • linear regression analysis
  • confounding variables
  • dependent variable
  • independent variable
  • measurement levels
  • mutate function
  • select function
  • intercept interpretation
  • slope interpretation
  • regression coefficients
  • data inspection

Descriptive Statistics and Reliability Analysis R Code

R code overview for performing descriptive statistics and reliability analysis using tidyverse, summarytools, sjPlot, and psych libraries.

  • descriptive statistics
  • reliability analysis
  • data mutation
  • factor conversion
  • numeric conversion
  • correlation tables
  • scaling variables

R Code for Factor Analysis

R code overview for factor analysis, controlling for confounding variables, and data manipulation using tidyverse and psych libraries.

  • Factor analysis
  • Controlling for confounding variables
  • Data manipulation
  • Parallel analysis
  • Oblimin rotation
  • Correlation tables
  • Data summary

R Code for Mediation and Moderation Analysis

R code examples demonstrating mediation analysis using Sobel tests and moderation analysis using linear models.

  • Mediation analysis
  • Sobel test
  • Moderation analysis
  • Linear models
  • Political participation
  • Purchase intention
  • Social proof
  • Product attitude

Mediation Analysis and R Implementation

Causal Models with Mediating Variables

Mediation analysis explores how the total causal effect is split into a direct effect and an indirect effect via a mediator.

  • total causal effect
  • direct effect
  • indirect effect
  • mediation analysis
  • mediating variables
  • confounder
  • Sobel test
  • regression
  • causal models

Topic 1

R Code for Mediation Analysis

This content covers mediation analysis using R code to calculate indirect, direct, and total effects and perform the Sobel test.

  • Mediation analysis
  • Indirect effect
  • Direct effect
  • Total effect
  • Sobel test
  • Statistical significance
  • Partial mediation
  • Full mediation
  • Regression coefficient
  • Standard error

Mediation Analysis and R Code

This topic covers mediation analysis including direct effect, indirect effect, and total effect using R code and linear regression models.

  • Mediation analysis
  • Direct effect (c’)
  • Indirect effect (path a * b)
  • Total effect (c)
  • Linear regression model
  • Dependent variable (Y)
  • Independent variable (X)
  • Mediator (M)
  • Intercept
  • Slope
  • Standardised regression coefficients (beta)
  • Full mediation
  • Partial mediation
  • Confidence interval
  • p-value

Conducting ANOVA and ANCOVA in R

Two-way ANOVA in R

Learn how to conduct and interpret a two-way ANOVA to test whether the mean of a dependent variable differs between groups based on two independent variables and whether there is a significant interaction effect.

  • two-way ANOVA
  • dependent variable
  • independent variables
  • interaction effect
  • between-subjects experimental design
  • main effect
  • null hypothesis
  • alternative hypothesis

Two-way ANOVA Interpretation and R Code

Analyzing main effects and interaction effects using two-way ANOVA to determine if mean scores on a dependent variable differ based on two independent variables.

  • two-way ANOVA
  • main effects
  • interaction effect
  • F-statistic
  • statistically significant
  • null hypothesis
  • estimated marginal means
  • equal error variances
  • independent variable
  • dependent variable

One-way ANOVA and R Code Calculations

Example exam questions regarding R code for one-way ANOVA, calculating mean squares of the model, and interpreting r using eta squared and R2.

  • one-way ANOVA
  • mean squares of the model (MSM)
  • sum of squares (SSM)
  • degrees of freedom (df)
  • eta squared
  • r calculation

R Statistical Analyses and Scale Construction

R Statistical Analyses and Package Implementation

This document provides R code and outputs for performing statistical analyses including factor analysis, linear models, and data summaries using tidyverse, psych, and sjPlot packages.

  • R-analyses
  • tidyverse
  • summarytools
  • factor analysis
  • parallel analysis
  • correlation matrix
  • linear models
  • multiple R-squared
  • standardized loadings
  • oblimin rotation
  • mediation
  • interaction effects
  • item complexity
  • residual standard error

R Statistical Analysis of Two-Way ANOVA

R code and output demonstrating two-way ANOVA using summarize, group_by, and aov_car to analyze Maritalb and Sex effects on Happy.

  • summarise()
  • group_by()
  • two-way ANOVA
  • Anova Table (Type 3 tests)
  • plot_model()
  • Maritalb
  • Sex
  • Happy

Scale Construction Numeric Variable Summary

A summary of numeric variables including mean, standard deviation, minimum, median, maximum, and interquartile range.

  • Mean (sd)
  • min ≤ med ≤ max
  • IQR (CV)
  • Numeric variables

Scale Construction and Factor Analysis

  • Correlation
  • Parallel analysis
  • Scree plots
  • Eigenvalues
  • Factor analysis
  • Standardized loadings
  • Pattern matrix
  • RMSEA index
  • Factor score adequacy
  • Reliability

Two-Way ANOVA and Social Status Analysis

Statistical output and R code for performing a Two-Way ANOVA on Socstatus using Lowbrow and Highbrow variables.

  • Two-Way ANOVA
  • Type 3 tests
  • Test for Homogeneity of Variance
  • Data Frame Summary
  • Predicted values
  • Factor variables
  • Anova Table

R Output for One-way ANOVA Analysis

  • One-way ANOVA
  • One-way MANOVA
  • Data Frame Summary
  • Sum of Squares
  • F value
  • Degrees of Freedom
  • Predicted values

Statistical Techniques and Reliability Analysis in R

R Code for Descriptives and Reliability Analysis

This content covers R code for descriptive statistics and reliability analysis, focusing on measurement levels and data inspection.

  • Nominal variables
  • Ordinal variables
  • Continuous variables
  • Measurement levels
  • Descriptive statistics
  • Frequencies and percentages
  • Mean
  • Standard deviation
  • Median
  • Range
  • dplyr::select
  • Univariate descriptives
  • Bivariate descriptives
  • Cross-tabulation table

Introduction to Statistical Techniques and RStudio

Learn the basics of statistical techniques used in communication science and how to analyze data using the R program and RStudio interface.

  • statistical techniques
  • communication science
  • descriptive statistics
  • scale construction
  • reliability analysis
  • factor analysis
  • regression analysis
  • confounders
  • mediating variables
  • moderation
  • experimental designs
  • RStudio interface
  • R Script
  • Quarto
  • R packages

Causal Models and Regression Analysis

Controlling for Confounding Variables in Regression

This content explains how to interpret regression coefficients, slopes, and intercepts when analyzing the effect of an independent variable on a dependent variable while controlling for a confounder.

  • regression coefficient
  • slope
  • intercept
  • independent variable
  • dependent variable
  • confounder
  • t-value
  • p-value
  • confidence interval
  • linear regression model
  • standardised regression coefficients
  • controlling for confounders

Topic 1

Causal Models and Confounding Variables

This lecture examines explanatory research regarding cause-and-effect relationships, causal models, and the use of regression and correlation analysis to test hypotheses.

  • explanatory research
  • cause-and-effect relationships
  • causal models
  • confounding variables
  • regression analysis
  • correlation analysis
  • hypotheses
  • spurious relations

Causal Research in Experiments and Non-Experiments

This content discusses establishing cause-and-effect relationships through experimental manipulation and randomization or through inferring causality in observational studies by controlling confounding variables.

  • experimental research
  • random assignment
  • manipulation
  • non-experimental studies
  • observational studies
  • cause-and-effect relationships
  • confounding variables
  • spurious correlation
  • statistical controls
  • multivariate analysis
  • stepwise multiple regression models

Causal Models and Regression Analysis

This content explores the distinction between correlation and causation, the role of confounding variables, and the application of linear regression models to infer causal relationships.

  • Causal models
  • Confounding variables
  • Correlation vs causation
  • Regression analysis
  • Simple regression
  • Multiple regression
  • Dependent variable
  • Independent variable
  • Linear model
  • Intercept
  • Slope
  • Method of least squares
  • Residuals
  • Sum of squared residuals
  • Total sum of squares
  • Goodness-of-fit
  • Explained variance

Causal Models and Multiple Regression

Multiple regression is used to test causal models by keeping confounding variables constant and estimating the effects of variables on a dependent variable.

  • causal models
  • multiple regression
  • simple regression model
  • confounding variables
  • mediation
  • bivariate relationship
  • intercept
  • regression coefficient
  • standard error
  • t value
  • significance
  • controlling for confounding variables

Significance Testing and Regression Analysis

This content covers hypothesis significance testing in regression analysis, including the use of F-statistics, t-statistics, confidence intervals, and effect size to generalize results to the population.

  • Causal models
  • Confounding variables
  • Hypothesis significance testing
  • Null hypothesis (H0)
  • Alternative hypothesis (H1)
  • P-value
  • Significance level (alpha)
  • F-statistic
  • Goodness-of-fit
  • T-statistic
  • Regression coefficients
  • Standard error
  • Confidence intervals
  • Effect size
  • Standardized b-coefficient
  • Linearity assumption
  • Homoscedasticity
  • Heteroscedasticity

Scale Construction and Factor Analysis Techniques

Reliability, Validity, and Latent Variable Measurement

This lecture covers scale construction, measurement reliability and validity, and the use of factor analysis to determine dimensionality of latent variables.

  • Reliability
  • Validity
  • Internal validity
  • External validity
  • Scale construction
  • Factor analysis
  • Latent variable
  • Dimensionality
  • Factor loadings
  • Univariate information
  • Bivariate correlations

Factor Analysis in Scale Construction

Factor analysis is used for scale construction to identify dimensions such as high culture and popular culture.

  • Factor analysis
  • Scale construction
  • High culture
  • Popular culture
  • Factor loadings
  • Dimensions

Scale Construction and Factor Analysis

Steps in the construction of a scale include determining dimensionality using factor analysis and performing reliability analyses to calculate the measure of the latent concept.

  • Factor analysis
  • Scale construction
  • Source literacy
  • Analytical media literacy
  • Online active engagement
  • Reliability analyses
  • Latent concept
  • Kaiser criterion
  • Oblimin rotation
  • Dimensionality

Factor Analysis and Dimensionality Determination

Determining the number of dimensions in a concept using the Kink criterion and Kaiser criterion through factor analysis.

  • Factor analysis
  • Dimensions
  • Factor loadings
  • Kink criterion
  • Kaiser criterion
  • Eigenvalues
  • Scree plot
  • Point of inflection

Factor Analysis and Factor Loading Estimation

Estimating factor loadings through a causal model of spurious correlations and using rotation to interpret factors.

  • causal model of factor analysis
  • factor loadings
  • spurious correlations
  • rotation
  • oblimin rotation
  • latent factors
  • cross-loadings
  • interpretation of factors

Introduction to Factor Analysis in R

Learn to conduct and interpret Exploratory Factor Analysis in R to determine underlying dimensions and the structure of observed variables.

  • Factor analysis
  • Exploratory Factor Analysis (EFA)
  • Underlying dimensions
  • Latent factor
  • Observed variables
  • Factor loadings
  • Reliability analysis
  • Political efficacy
  • Construct

R Code for Factor Analysis

This guide covers R code for factor analysis, including data inspection, checking correlations, and determining the number of factors using scree plots and Kaiser’s criterion.

  • factor analysis
  • R code
  • measurement levels
  • nominal
  • interval/ratio
  • univariate descriptives
  • bivariate descriptives
  • correlation tables
  • scree plot
  • Kaiser’s criterion
  • eigenvalues
  • parallel analysis
  • Principal Axis Factoring

Regression Analysis, Moderation, and Mediation

Regression Analysis and Model Output

This document presents R code and statistical output for linear regression models analyzing Workhrs, Religious, and Age variables.

  • linear regression
  • descriptive data analysis
  • coefficients
  • residual standard error
  • multiple R-squared
  • adjusted R-squared
  • F-statistic
  • p-value
  • standardized CI
  • degrees of freedom

Regression Analysis and Moderation Output

Statistical output displaying regression coefficients, residuals, and moderation effects for religious and age predictors.

  • Regression
  • Moderation
  • Coefficients
  • Residuals
  • Adjusted R-squared
  • F-statistic
  • p-value
  • Standard error
  • Heteroscedasticity

Regression Analysis and Data Frame Summary

This document presents R code for data frame summary and linear model regression analysis using variables such as Female, Workhrs, and Income.

  • linear model
  • regression coefficients
  • residual analysis
  • data frame summary
  • statistical significance
  • standard error
  • degrees of freedom

Regression Analysis and Mediation Output

Statistical analysis of linear regression models using R code, summary output, and fitted values.

  • Multiple R-squared
  • Adjusted R-squared
  • F-statistic
  • p-value
  • Intercept
  • Standardized estimates
  • Residual standard error
  • Degrees of freedom
  • Linear regression model
  • Fitted values
  • Residuals

Regression Analysis and Mediation

This material examines regression analysis and mediation through studies of income differences between men and women and the extent they are explained by working hours.

  • Regression analysis
  • Mediation
  • Unstandardized effect
  • Direct effect
  • Indirect effect
  • Mediation effect
  • Variance
  • Causal models
  • t-value

Experimental Designs Using R and ANCOVA

Experimental Designs and ANCOVA Analysis

  • Covariates
  • F-statistic
  • Homogeneity of variance
  • Variance ratio
  • Within group variance
  • Between groups variance
  • Estimated marginal means
  • Posthoc tests
  • Sum of squares
  • Confounding variables

Defining 0-Categories in X Variables

The lecture discusses defining a well-defined 0-category in X-variables and recoding gender to create a well-defined 0-category.

  • causal models with moderation
  • well defined 0-category
  • recode gender
  • descriptives

Experimental Designs and Statistical Analysis

Experimental Design and Analysis of Variance

This topic covers the principles of experimental research, including randomization and cause-effect hypotheses, and introduces analysis of variance (ANOVA) and analysis of covariance (ANCOVA) for comparing group means.

  • Experiment
  • Twoway ANOVA
  • Twoway ANCOVA
  • Cause-effect hypotheses
  • Randomization
  • Independent variable
  • Confounding variables
  • Internal validity
  • External validity
  • Generalizability
  • Explanatory power

Experimental Designs and Factorial Analysis

Twoway ANOVA and Factorial Designs

  • Factorial designs
  • Twoway ANOVA
  • Main effects
  • Interaction effect
  • Moderation model
  • Partitioning the variances
  • Sum of squares
  • F-tests
  • Estimated marginal means
  • Posthoc contrasts tests
  • Generalized eta squared

Experimental Designs and ANOVA Assumptions

Twoway ANCOVA and ANOVA Assumptions

  • Assumption of homogeneity of variance
  • Variance ratio
  • Within-group variances
  • F-test
  • Standard deviation
  • Standard error
  • Twoway ANCOVA
  • Twoway ANOVA
  • Homoscedasticity
  • Homogeneity of variance
  • Estimated marginal means
  • F-tests
  • Effect sizes
  • Posthoc contrasts tests

Quantitative Scale Construction and Factor Analysis

Exploratory Factor Analysis in R

Learn to conduct and interpret Exploratory Factor Analysis in R to determine the underlying structure of observed variables and identify latent factors.

  • Exploratory Factor Analysis (EFA)
  • Factor analysis
  • Latent factor
  • Underlying structure
  • Observed variables
  • Factor loadings
  • Reliability analysis
  • Political efficacy
  • Factor analysis

Quantitative Research Scale Construction and Reliability

  • Measurement errors
  • Reliability
  • Validity
  • Internal validity
  • External validity
  • Scale construction
  • Latent concept
  • Average correlation
  • Unidimensional items

Steps in the Construction of a Scale

This lecture outlines the process of constructing a scale to measure a latent concept through descriptive information, correlations, factor analysis, and reliability analysis.

  • descriptive information
  • univariate information
  • bivariate correlations
  • factor analysis
  • reliability analysis
  • latent concept
  • missing values
  • reverse-coding
  • standardization
  • z-scores
  • item-scale
  • media literacy

Causal Models and R Code for Moderation Analysis

Causal Models with Moderation and Interaction

This topic examines moderation analysis using causal models to determine how the effect of one variable varies across different values of another variable.

  • moderation analysis
  • interaction effect
  • centering
  • main effects
  • continuous variable
  • dichotomous variable
  • significance testing
  • t-value
  • p-value
  • confidence intervals
  • regression lines

Causal Models with Moderation Analysis

Examine moderation analysis to understand how the effect of an independent variable varies based on a moderator through interaction effects and significance testing.

  • moderation analysis
  • basic model without moderation
  • moderation model
  • interaction effect
  • main effects
  • different slopes
  • parallel regression lines
  • significance testing
  • t-value
  • p-value
  • confidence intervals
  • multicollinearity
  • centering continuous variables
  • recoding dichotomous variables

R Code for Moderation Analysis

This lecture covers R code for moderation analysis, focusing on the interaction effect between an independent variable and a moderator on a dependent variable.

  • moderation analysis
  • interaction effect
  • linear regression model
  • independent variable
  • moderator
  • dependent variable
  • interaction term
  • standardised regression coefficients
  • main effects
  • slope
  • confidence interval
  • test statistic

Moderation Analysis and Regression Interpretation

Interpretation of intercept, slope, and effects of political orientation and education level on attitude towards migrants using R code for moderation analysis.

  • Moderation analysis
  • Intercept
  • Slope
  • Political orientation
  • Education level
  • Attitude towards migrants
  • Regression model
  • Variance

Topic 1

Statistical Analysis of Social and Psychological Variables

Mediation of Education on Trust via Political Orientation

Examine the effect of education on trust in institutions and the extent to which this effect can be explained by political left-right orientation using mediation analysis.

  • regression analysis
  • mediation analysis
  • total effect
  • indirect effect
  • regression coefficient

Scale Construction and Trust Analysis

Perform scale construction and factor analysis in RStudio using European Social Survey data to examine trust in people and institutions.

  • scale construction
  • correlation table
  • Kaiser's criterion
  • Kink-1 criterion
  • scree plot
  • factor analysis
  • principal axis factoring
  • direct oblimin rotation
  • reliability analysis

Regression, Mediation, and ANOVA Analysis

Examine the effects of education, marital status, gender, and political orientation on trust in institutions and the degree to which people feel happy using regression, mediation, and two-way ANOVA.

  • Regression analysis
  • Dependent variable
  • Independent variables
  • Dummy variables
  • Reference category
  • Intercept
  • Interaction
  • Regression coefficient
  • Two-way ANOVA
  • Test statistic
  • F-value
  • mediation analysis
  • total effect
  • indirect effect

Scale Construction, Factor Analysis, and Reliability Analysis

This content contains practice exam questions regarding scale construction, factor analysis, and reliability analysis using items assessing expected social status.

  • scale construction
  • descriptive analyses
  • correlation table
  • factor analysis
  • scree plot
  • Kaiser's criterion
  • reliability analysis
  • item overlap
  • standardization
  • recoding
  • underlying dimensions
  • item processing

Regression Analysis and Moderation

Examine regression analysis and moderation through analyses of how women's working hours depend on religiosity and age.

  • regression analysis
  • moderation
  • confounding variable
  • mediating variable
  • interaction
  • main effect
  • t-value
  • significance tests
  • homoscedasticity

ANCOVA Analysis and Statistical Testing

This content examines ANCOVA and statistical modeling using simulated datasets to investigate the effect of remedies on subjective well-being using a covariate.

  • one-way ANOVA
  • covariate
  • subjective well-being
  • residuals
  • sum of squares
  • null hypothesis
  • F-value
  • error variance
  • assumption of independence

Two-Way ANOVA of Music Preferences and Social Status

Analysis to investigate whether combinations of highbrow and lowbrow music preferences lead to differences in perceived social status.

  • Two-way ANOVA
  • interaction effect
  • main effect
  • dependent variable
  • independent variables
  • alternative hypothesis
  • F-value
  • error variance
  • effect size
  • sample mean plot
  • perceived social status
  • Assumption of equal error variances

Make it your own.

Keep these readings and topics in a new study set, or add them to one you already use.