library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.1 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── 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(plspm)
##
## Attaching package: 'plspm'
##
## The following object is masked from 'package:ggplot2':
##
## alpha
library(car)
## Loading required package: carData
##
## Attaching package: 'car'
##
## The following object is masked from 'package:dplyr':
##
## recode
##
## The following object is masked from 'package:purrr':
##
## some
# read data from the web
df_articulo_9 <- read.csv("https://docs.google.com/spreadsheets/d/1E_w5qeAtfRIdc3QG6UWreU4uSmCEQ4cEq2_OlrabxWM/export?format=csv&gid=1677566702", header = TRUE, sep = ",", stringsAsFactors = FALSE)
df_articulo_9_standardized <- data.frame(
impact_sc = scale(df_articulo_9$impact),
size_sc = scale(df_articulo_9$Size),
tie_strength_sc = scale(df_articulo_9$tie_strength),
networking_intensity_sc = scale(df_articulo_9$networking_intensity),
structural_holes_sc = scale(df_articulo_9$structural_holes),
CDI_sc = scale(df_articulo_9$CDI),
tenure_sc = scale(df_articulo_9$tenure)
)
# Inner model
inner_model <- matrix(c(
0, 0, 0, 0, # research_impact
1, 0, 0, 0, # social_capital
1, 0, 0, 0, # relational_capital
1, 0, 0, 0 # cognitive_capital
), nrow = 4, ncol = 4, byrow = TRUE)
# Outer model
outer_model <- list(
research_impact = c("impact"),
social_capital = c("Size", "structural_holes"),
relational_capital = c("tie_strength", "networking_intensity"),
cognitive_capital = c("CDI", "tenure")
)
# Run the PLS-PM analysis
plspm_model <- plspm(df_articulo_9, inner_model, outer_model, modes = c("B", "A", "A", "A"))
# Get the summary of the results
summary(plspm_model)
## PARTIAL LEAST SQUARES PATH MODELING (PLS-PM)
##
## ----------------------------------------------------------
## MODEL SPECIFICATION
## 1 Number of Cases 535
## 2 Latent Variables 4
## 3 Manifest Variables 7
## 4 Scale of Data Standardized Data
## 5 Non-Metric PLS FALSE
## 6 Weighting Scheme centroid
## 7 Tolerance Crit 1e-06
## 8 Max Num Iters 100
## 9 Convergence Iters 3
## 10 Bootstrapping FALSE
## 11 Bootstrap samples NULL
##
## ----------------------------------------------------------
## BLOCKS DEFINITION
## Block Type Size Mode
## 1 LV1 Exogenous 1 B
## 2 LV2 Endogenous 2 A
## 3 LV3 Endogenous 2 A
## 4 LV4 Endogenous 2 A
##
## ----------------------------------------------------------
## BLOCKS UNIDIMENSIONALITY
## Mode MVs C.alpha DG.rho eig.1st eig.2nd
## LV1 B 1 1.000 1.00e+00 1.00 0.000
## LV2 A 2 0.000 3.93e-31 1.50 0.502
## LV3 A 2 0.088 6.87e-01 1.05 0.954
## LV4 A 2 0.000 8.12e-30 1.05 0.949
##
## ----------------------------------------------------------
## OUTER MODEL
## weight loading communality redundancy
## LV1
## 1 impact 1.000 1.000 1.0000 0.00000
## LV2
## 2 Size -0.383 0.757 0.5737 0.02775
## 2 structural_holes 0.753 -0.943 0.8899 0.04304
## LV3
## 3 tie_strength 0.957 0.968 0.9378 0.01678
## 3 networking_intensity 0.250 0.294 0.0863 0.00154
## LV4
## 4 CDI 0.867 -0.890 0.7926 0.05445
## 4 tenure -0.456 0.500 0.2502 0.01719
##
## ----------------------------------------------------------
## CROSSLOADINGS
## LV1 LV2 LV3 LV4
## LV1
## 1 impact 1.0000 0.2199 0.1338 0.2621
## LV2
## 2 Size 0.1180 0.7574 -0.0176 0.2173
## 2 structural_holes -0.2322 -0.9434 0.0474 -0.3715
## LV3
## 3 tie_strength 0.1309 -0.0973 0.9684 0.6866
## 3 networking_intensity 0.0342 0.2030 0.2938 0.0289
## LV4
## 4 CDI -0.2368 -0.0512 -0.7792 -0.8903
## 4 tenure 0.1245 0.6983 -0.0250 0.5002
##
## ----------------------------------------------------------
## INNER MODEL
## $LV2
## Estimate Std. Error t value Pr(>|t|)
## Intercept 3.22e-17 0.0423 7.63e-16 1.00e+00
## LV1 2.20e-01 0.0423 5.20e+00 2.78e-07
##
## $LV3
## Estimate Std. Error t value Pr(>|t|)
## Intercept 8.82e-17 0.0429 2.05e-15 1.00000
## LV1 1.34e-01 0.0429 3.12e+00 0.00193
##
## $LV4
## Estimate Std. Error t value Pr(>|t|)
## Intercept 1.59e-16 0.0418 3.79e-15 1.00e+00
## LV1 2.62e-01 0.0418 6.27e+00 7.46e-10
##
## ----------------------------------------------------------
## CORRELATIONS BETWEEN LVs
## LV1 LV2 LV3 LV4
## LV1 1.000 0.2199 0.1338 0.262
## LV2 0.220 1.0000 -0.0424 0.363
## LV3 0.134 -0.0424 1.0000 0.664
## LV4 0.262 0.3628 0.6642 1.000
##
## ----------------------------------------------------------
## SUMMARY INNER MODEL
## Type R2 Block_Communality Mean_Redundancy AVE
## LV1 Exogenous 0.0000 1.000 0.00000 0.000
## LV2 Endogenous 0.0484 0.732 0.03539 0.732
## LV3 Endogenous 0.0179 0.512 0.00916 0.512
## LV4 Endogenous 0.0687 0.521 0.03582 0.521
##
## ----------------------------------------------------------
## GOODNESS-OF-FIT
## [1] 0.1627
##
## ----------------------------------------------------------
## TOTAL EFFECTS
## relationships direct indirect total
## 1 LV1 -> LV2 0.220 0 0.220
## 2 LV1 -> LV3 0.134 0 0.134
## 3 LV1 -> LV4 0.262 0 0.262
## 4 LV2 -> LV3 0.000 0 0.000
## 5 LV2 -> LV4 0.000 0 0.000
## 6 LV3 -> LV4 0.000 0 0.000
VIF
library(car)
# Create a linear model
linear_model <- lm(impact_sc ~ size_sc + structural_holes_sc + tie_strength_sc + networking_intensity_sc + CDI_sc + tenure_sc,
data = df_articulo_9_standardized)
# Calculate VIF
vif_values <- vif(linear_model)
# Print VIF values
print(vif_values)
## size_sc structural_holes_sc tie_strength_sc
## 1.925897 1.941834 2.933087
## networking_intensity_sc CDI_sc tenure_sc
## 1.310612 2.928161 2.261231
Correlation matrix
Correlation between variables
library(apaTables)
library(car)
# Compute VIF
vif_values <- vif(lm(impact ~ ., data = df_articulo_9))
# Create APA-style correlation table
apa_corr_table <- apaTables::apa.cor.table(df_articulo_9)
# Add VIF row to the APA-style correlation table
apa_corr_table$Table <- rbind(apa_corr_table$Table, c("VIF", sprintf("%.2f", vif_values)))
# Print the updated APA-style correlation table
print(apa_corr_table)
##
##
## Means, standard deviations, and correlations with confidence intervals
##
##
## Variable M SD 1 2 3
## 1. impact 4.28 7.64
##
## 2. Size 16.52 26.34 .12**
## [.03, .20]
##
## 3. structural_holes 0.43 0.34 -.23** -.50**
## [-.31, -.15] [-.56, -.43]
##
## 4. Density 0.52 0.31 -.26** -.57** .95**
## [-.34, -.18] [-.62, -.50] [.94, .96]
##
## 5. tie_strength 1.74 1.22 .13** -.11* .08
## [.05, .21] [-.19, -.02] [-.01, .16]
##
## 6. total_weighted 57.33 101.89 .14** .91** -.49**
## [.06, .23] [.89, .92] [-.55, -.42]
##
## 7. CDI 0.71 0.24 -.24** .04 .09*
## [-.32, -.16] [-.04, .13] [.00, .17]
##
## 8. tenure 17.35 16.95 .12** .56** -.64**
## [.04, .21] [.50, .61] [-.69, -.59]
##
## 9. networking_intensity 3.62 4.38 .03 .34** -.10*
## [-.05, .12] [.26, .41] [-.18, -.01]
##
## 4 5 6 7 8
##
##
##
##
##
##
##
##
##
##
##
## .06
## [-.02, .15]
##
## -.52** -.00
## [-.58, -.45] [-.09, .08]
##
## .10* -.80** -.07
## [.02, .19] [-.82, -.76] [-.15, .02]
##
## -.69** -.01 .53** -.05
## [-.73, -.65] [-.09, .08] [.47, .59] [-.14, .03]
##
## .02 .05 .44** -.07 -.08
## [-.06, .11] [-.04, .13] [.37, .51] [-.16, .01] [-.16, .01]
##
##
## 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.
##
Cohens d
# Standardize the dataset
df_articulo_9_standardized_new <- as.data.frame(scale(df_articulo_9))
# Full model with all predictors
full_model_new <- lm(impact ~ Size + structural_holes + tie_strength + networking_intensity + CDI + tenure, data = df_articulo_9_standardized_new)
# Models without each predictor
model_without_size <- lm(impact ~ structural_holes + tie_strength + networking_intensity + CDI + tenure, data = df_articulo_9_standardized_new)
model_without_sh <- lm(impact ~ Size + tie_strength + networking_intensity + CDI + tenure, data = df_articulo_9_standardized_new)
model_without_ts <- lm(impact ~ Size + structural_holes + networking_intensity + CDI + tenure, data = df_articulo_9_standardized_new)
model_without_ni <- lm(impact ~ Size + structural_holes + tie_strength + CDI + tenure, data = df_articulo_9_standardized_new)
model_without_cdi <- lm(impact ~ Size + structural_holes + tie_strength + networking_intensity + tenure, data = df_articulo_9_standardized_new)
model_without_tenure <- lm(impact ~ Size + structural_holes + tie_strength + networking_intensity + CDI, data = df_articulo_9_standardized_new)
# Calculate R² for each model
r2_full_new <- summary(full_model_new)$r.squared
r2_without_size <- summary(model_without_size)$r.squared
r2_without_sh <- summary(model_without_sh)$r.squared
r2_without_ts <- summary(model_without_ts)$r.squared
r2_without_ni <- summary(model_without_ni)$r.squared
r2_without_cdi <- summary(model_without_cdi)$r.squared
r2_without_tenure <- summary(model_without_tenure)$r.squared
# Calculate Cohen's f² for each predictor
f2_size <- (r2_full_new - r2_without_size) / (1 - r2_full_new)
f2_sh <- (r2_full_new - r2_without_sh) / (1 - r2_full_new)
f2_ts <- (r2_full_new - r2_without_ts) / (1 - r2_full_new)
f2_ni <- (r2_full_new - r2_without_ni) / (1 - r2_full_new)
f2_cdi <- (r2_full_new - r2_without_cdi) / (1 - r2_full_new)
f2_tenure <- (r2_full_new - r2_without_tenure) / (1 - r2_full_new)
# Print Cohen's f² values
cat("Cohen's f² for Size: ", f2_size, "\n")
## Cohen's f² for Size: 0.002223503
cat("Cohen's f² for Structural_Holes: ", f2_sh, "\n")
## Cohen's f² for Structural_Holes: 0.02725953
cat("Cohen's f² for Tie_Strength: ", f2_ts, "\n")
## Cohen's f² for Tie_Strength: 0.001712219
cat("Cohen's f² for Networking_Intensity: ", f2_ni, "\n")
## Cohen's f² for Networking_Intensity: 0.0007836913
cat("Cohen's f² for CDI: ", f2_cdi, "\n")
## Cohen's f² for CDI: 0.02969747
cat("Cohen's f² for Tenure: ", f2_tenure, "\n")
## Cohen's f² for Tenure: 0.002226705