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/1GB2Wf6Bkl4ZI6kpTXO1-FodSIrLXY7ODS1vFIkaGUpM/export?format=csv&gid=1818010937", 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 337
## 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 0.00e+00 1.46 0.536
## LV3 A 2 0.587 8.29e-01 1.42 0.585
## LV4 A 2 0.000 2.35e-29 1.03 0.969
##
## ----------------------------------------------------------
## OUTER MODEL
## weight loading communality redundancy
## LV1
## 1 impact 1.000 1.000 1.000 0.0000
## LV2
## 2 Size -0.426 0.764 0.584 0.0255
## 2 structural_holes 0.728 -0.926 0.858 0.0375
## LV3
## 3 tie_strength 0.662 0.879 0.773 0.0603
## 3 networking_intensity 0.524 0.799 0.638 0.0497
## LV4
## 4 CDI -0.674 0.697 0.485 0.0553
## 4 tenure 0.718 -0.739 0.546 0.0622
##
## ----------------------------------------------------------
## CROSSLOADINGS
## LV1 LV2 LV3 LV4
## LV1
## 1 impact 1.000 0.2091 0.2793 -0.337
## LV2
## 2 Size 0.125 0.7642 0.2052 -0.430
## 2 structural_holes -0.214 -0.9260 -0.1103 0.537
## LV3
## 3 tie_strength 0.259 -0.0311 0.8792 -0.514
## 3 networking_intensity 0.205 0.3596 0.7986 -0.280
## LV4
## 4 CDI -0.235 -0.0763 -0.7372 0.697
## 4 tenure 0.250 0.7285 -0.0144 -0.739
##
## ----------------------------------------------------------
## INNER MODEL
## $LV2
## Estimate Std. Error t value Pr(>|t|)
## Intercept 1.90e-17 0.0534 3.55e-16 1.00000
## LV1 2.09e-01 0.0534 3.91e+00 0.00011
##
## $LV3
## Estimate Std. Error t value Pr(>|t|)
## Intercept -5.13e-17 0.0525 -9.79e-16 1.00e+00
## LV1 2.79e-01 0.0525 5.32e+00 1.87e-07
##
## $LV4
## Estimate Std. Error t value Pr(>|t|)
## Intercept 2.21e-16 0.0514 4.30e-15 1.00e+00
## LV1 -3.37e-01 0.0514 -6.56e+00 2.04e-10
##
## ----------------------------------------------------------
## CORRELATIONS BETWEEN LVs
## LV1 LV2 LV3 LV4
## LV1 1.000 0.209 0.279 -0.337
## LV2 0.209 1.000 0.168 -0.574
## LV3 0.279 0.168 1.000 -0.487
## LV4 -0.337 -0.574 -0.487 1.000
##
## ----------------------------------------------------------
## SUMMARY INNER MODEL
## Type R2 Block_Communality Mean_Redundancy AVE
## LV1 Exogenous 0.0000 1.000 0.0000 0.000
## LV2 Endogenous 0.0437 0.721 0.0315 0.721
## LV3 Endogenous 0.0780 0.705 0.0550 0.705
## LV4 Endogenous 0.1138 0.516 0.0587 0.516
##
## ----------------------------------------------------------
## GOODNESS-OF-FIT
## [1] 0.2254
##
## ----------------------------------------------------------
## TOTAL EFFECTS
## relationships direct indirect total
## 1 LV1 -> LV2 0.209 0 0.209
## 2 LV1 -> LV3 0.279 0 0.279
## 3 LV1 -> LV4 -0.337 0 -0.337
## 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
## 2.129387 2.103361 3.149609
## networking_intensity_sc CDI_sc tenure_sc
## 1.970617 2.898448 2.635898
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 3.12 5.42
##
## 2. Size 28.82 44.88 .13*
## [.02, .23]
##
## 3. structural_holes 0.34 0.31 -.21** -.46**
## [-.31, -.11] [-.54, -.38]
##
## 4. Density 0.46 0.31 -.22** -.54** .92**
## [-.32, -.11] [-.61, -.46] [.90, .94]
##
## 5. tie_strength 1.98 1.23 .26** -.03 .03
## [.16, .36] [-.14, .08] [-.08, .13]
##
## 6. total_weighted 195.34 338.59 .31** .83** -.45**
## [.21, .40] [.79, .86] [-.53, -.36]
##
## 7. CDI 0.62 0.24 -.23** -.04 .08
## [-.33, -.13] [-.15, .06] [-.03, .18]
##
## 8. tenure 16.73 12.72 .25** .56** -.67**
## [.15, .35] [.48, .63] [-.73, -.61]
##
## 9. networking_intensity 11.46 15.04 .21** .43** -.24**
## [.10, .31] [.34, .51] [-.34, -.14]
##
## 4 5 6 7 8
##
##
##
##
##
##
##
##
##
##
##
## .03
## [-.08, .13]
##
## -.49** .23**
## [-.57, -.41] [.13, .33]
##
## .10 -.80** -.27**
## [-.01, .20] [-.84, -.76] [-.37, -.17]
##
## -.74** -.04 .47** -.03
## [-.79, -.69] [-.14, .07] [.38, .55] [-.14, .08]
##
## -.14** .42** .69** -.39** .02
## [-.24, -.04] [.32, .50] [.63, .74] [-.48, -.30] [-.09, .13]
##
##
## 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.00785158
cat("Cohen's f² for Structural_Holes: ", f2_sh, "\n")
## Cohen's f² for Structural_Holes: 0.0007125724
cat("Cohen's f² for Tie_Strength: ", f2_ts, "\n")
## Cohen's f² for Tie_Strength: 0.01419402
cat("Cohen's f² for Networking_Intensity: ", f2_ni, "\n")
## Cohen's f² for Networking_Intensity: 0.01489351
cat("Cohen's f² for CDI: ", f2_cdi, "\n")
## Cohen's f² for CDI: 3.491609e-05
cat("Cohen's f² for Tenure: ", f2_tenure, "\n")
## Cohen's f² for Tenure: 0.0392195