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/1ahDwn5n9oYUJal3r7YnzSZC-OsdT-eT6BhaaVAo3kY4/export?format=csv&gid=1107365205", 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 1098
## 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 1.00e+00 1.00 0.000
## LV2 A 2 0 4.89e-30 1.35 0.646
## LV3 A 2 0 5.10e-28 1.03 0.966
## LV4 A 2 0 1.13e-26 1.03 0.971
##
## ----------------------------------------------------------
## OUTER MODEL
## weight loading communality redundancy
## LV1
## 1 impact 1.000 1.000 1.000 0.00000
## LV2
## 2 Size 0.737 -0.901 0.813 0.01515
## 2 structural_holes -0.463 0.724 0.524 0.00978
## LV3
## 3 tie_strength 0.841 0.822 0.675 0.00482
## 3 networking_intensity 0.570 0.542 0.294 0.00209
## LV4
## 4 CDI -0.515 0.539 0.291 0.01813
## 4 tenure 0.843 -0.857 0.735 0.04587
##
## ----------------------------------------------------------
## CROSSLOADINGS
## LV1 LV2 LV3 LV4
## LV1
## 1 impact 1.0000 -0.1365 0.0845 -0.250
## LV2
## 2 Size 0.1328 -0.9015 0.3154 -0.409
## 2 structural_holes -0.0834 0.7242 -0.0926 0.531
## LV3
## 3 tie_strength 0.0688 0.0826 0.8217 -0.301
## 3 networking_intensity 0.0467 -0.6050 0.5419 -0.120
## LV4
## 4 CDI -0.1319 0.0128 -0.5468 0.539
## 4 tenure 0.2159 -0.6423 0.0474 -0.857
##
## ----------------------------------------------------------
## INNER MODEL
## $LV2
## Estimate Std. Error t value Pr(>|t|)
## Intercept -3.59e-17 0.0299 -1.20e-15 1.00e+00
## LV1 -1.37e-01 0.0299 -4.56e+00 5.63e-06
##
## $LV3
## Estimate Std. Error t value Pr(>|t|)
## Intercept 6.43e-17 0.0301 2.14e-15 1.00000
## LV1 8.45e-02 0.0301 2.81e+00 0.00511
##
## $LV4
## Estimate Std. Error t value Pr(>|t|)
## Intercept 1.44e-16 0.0292 4.91e-15 1.00e+00
## LV1 -2.50e-01 0.0292 -8.54e+00 4.43e-17
##
## ----------------------------------------------------------
## CORRELATIONS BETWEEN LVs
## LV1 LV2 LV3 LV4
## LV1 1.0000 -0.137 0.0845 -0.250
## LV2 -0.1365 1.000 -0.2755 0.548
## LV3 0.0845 -0.276 1.0000 -0.321
## LV4 -0.2498 0.548 -0.3214 1.000
##
## ----------------------------------------------------------
## SUMMARY INNER MODEL
## Type R2 Block_Communality Mean_Redundancy AVE
## LV1 Exogenous 0.00000 1.000 0.00000 0.000
## LV2 Endogenous 0.01864 0.669 0.01246 0.669
## LV3 Endogenous 0.00713 0.484 0.00346 0.484
## LV4 Endogenous 0.06239 0.513 0.03200 0.513
##
## ----------------------------------------------------------
## GOODNESS-OF-FIT
## [1] 0.1277
##
## ----------------------------------------------------------
## TOTAL EFFECTS
## relationships direct indirect total
## 1 LV1 -> LV2 -0.1365 0 -0.1365
## 2 LV1 -> LV3 0.0845 0 0.0845
## 3 LV1 -> LV4 -0.2498 0 -0.2498
## 4 LV2 -> LV3 0.0000 0 0.0000
## 5 LV2 -> LV4 0.0000 0 0.0000
## 6 LV3 -> LV4 0.0000 0 0.0000
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.498131 1.690643 1.742728
## networking_intensity_sc CDI_sc tenure_sc
## 2.012748 1.736952 2.096384
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.32 8.84
##
## 2. Size 68.87 146.59 .13**
## [.07, .19]
##
## 3. structural_holes 0.29 0.32 -.08** -.35**
## [-.14, -.02] [-.41, -.30]
##
## 4. Density 0.42 0.32 -.12** -.44** .91**
## [-.17, -.06] [-.48, -.39] [.90, .92]
##
## 5. tie_strength 1.54 1.17 .07* -.07* .07*
## [.01, .13] [-.13, -.01] [.01, .13]
##
## 6. total_weighted 709.81 1927.36 .12** .98** -.30**
## [.06, .18] [.98, .98] [-.35, -.24]
##
## 7. CDI 0.75 0.20 -.13** .02 .05
## [-.19, -.07] [-.04, .08] [-.01, .11]
##
## 8. tenure 25.72 21.26 .22** .50** -.60**
## [.16, .27] [.45, .54] [-.63, -.56]
##
## 9. networking_intensity 22.08 48.90 .05 .65** -.27**
## [-.01, .11] [.62, .68] [-.32, -.21]
##
## 4 5 6 7 8
##
##
##
##
##
##
##
##
##
##
##
## .07*
## [.01, .13]
##
## -.36** -.05
## [-.41, -.31] [-.11, .01]
##
## .08* -.64** .01
## [.02, .14] [-.68, -.61] [-.05, .07]
##
## -.67** -.04 .43** -.03
## [-.70, -.64] [-.10, .02] [.39, .48] [-.09, .03]
##
## -.20** -.03 .70** -.01 .14**
## [-.25, -.14] [-.09, .03] [.67, .73] [-.07, .05] [.08, .19]
##
##
## 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.0006058365
cat("Cohen's f² for Structural_Holes: ", f2_sh, "\n")
## Cohen's f² for Structural_Holes: 0.004751385
cat("Cohen's f² for Tie_Strength: ", f2_ts, "\n")
## Cohen's f² for Tie_Strength: 0.0001580355
cat("Cohen's f² for Networking_Intensity: ", f2_ni, "\n")
## Cohen's f² for Networking_Intensity: 5.558707e-05
cat("Cohen's f² for CDI: ", f2_cdi, "\n")
## Cohen's f² for CDI: 0.01216687
cat("Cohen's f² for Tenure: ", f2_tenure, "\n")
## Cohen's f² for Tenure: 0.03020645