Este informe presenta un análisis del salto vertical (Counter
Movement Jump o CMJ) a partir de datos experimentales.
El objetivo principal es identificar la variable con mayor correlación
con la altura de salto, construir un modelo lineal simple y evaluar su
ajuste y significancia estadística.
El documento incluye procedimientos de limpieza de datos, análisis
exploratorio, correlaciones, modelamiento lineal, diagnóstico de
supuestos, validación cruzada y una interpretación práctica de los
resultados.
required <- c("tidyverse", "readr", "janitor", "corrplot", "psych",
"broom", "car", "caret", "lmtest", "gt")
to_install <- required[!required %in% installed.packages()[, "Package"]]
if(length(to_install)) install.packages(to_install, repos = "https://cloud.r-project.org")
lapply(required, library, character.only = TRUE)
## [[1]]
## [1] "lubridate" "forcats" "stringr" "dplyr" "purrr" "readr"
## [7] "tidyr" "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [13] "grDevices" "utils" "datasets" "methods" "base"
##
## [[2]]
## [1] "lubridate" "forcats" "stringr" "dplyr" "purrr" "readr"
## [7] "tidyr" "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [13] "grDevices" "utils" "datasets" "methods" "base"
##
## [[3]]
## [1] "janitor" "lubridate" "forcats" "stringr" "dplyr" "purrr"
## [7] "readr" "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [13] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[4]]
## [1] "corrplot" "janitor" "lubridate" "forcats" "stringr" "dplyr"
## [7] "purrr" "readr" "tidyr" "tibble" "ggplot2" "tidyverse"
## [13] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
## [19] "base"
##
## [[5]]
## [1] "psych" "corrplot" "janitor" "lubridate" "forcats" "stringr"
## [7] "dplyr" "purrr" "readr" "tidyr" "tibble" "ggplot2"
## [13] "tidyverse" "stats" "graphics" "grDevices" "utils" "datasets"
## [19] "methods" "base"
##
## [[6]]
## [1] "broom" "psych" "corrplot" "janitor" "lubridate" "forcats"
## [7] "stringr" "dplyr" "purrr" "readr" "tidyr" "tibble"
## [13] "ggplot2" "tidyverse" "stats" "graphics" "grDevices" "utils"
## [19] "datasets" "methods" "base"
##
## [[7]]
## [1] "car" "carData" "broom" "psych" "corrplot" "janitor"
## [7] "lubridate" "forcats" "stringr" "dplyr" "purrr" "readr"
## [13] "tidyr" "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [19] "grDevices" "utils" "datasets" "methods" "base"
##
## [[8]]
## [1] "caret" "lattice" "car" "carData" "broom" "psych"
## [7] "corrplot" "janitor" "lubridate" "forcats" "stringr" "dplyr"
## [13] "purrr" "readr" "tidyr" "tibble" "ggplot2" "tidyverse"
## [19] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
## [25] "base"
##
## [[9]]
## [1] "lmtest" "zoo" "caret" "lattice" "car" "carData"
## [7] "broom" "psych" "corrplot" "janitor" "lubridate" "forcats"
## [13] "stringr" "dplyr" "purrr" "readr" "tidyr" "tibble"
## [19] "ggplot2" "tidyverse" "stats" "graphics" "grDevices" "utils"
## [25] "datasets" "methods" "base"
##
## [[10]]
## [1] "gt" "lmtest" "zoo" "caret" "lattice" "car"
## [7] "carData" "broom" "psych" "corrplot" "janitor" "lubridate"
## [13] "forcats" "stringr" "dplyr" "purrr" "readr" "tidyr"
## [19] "tibble" "ggplot2" "tidyverse" "stats" "graphics" "grDevices"
## [25] "utils" "datasets" "methods" "base"
ruta <- "C:/Users/monav/Downloads/Actividad 2 - c2_data (1).csv"
df <- read_csv(ruta, show_col_types = FALSE) %>%
clean_names() %>%
rename(jump_height_cm = jump_height_flight_time)
df$player_id <- as.factor(df$player_id)
head(df)
num_vars <- df %>% select(where(is.numeric))
summary(num_vars)
## x1 braking_phase_duration concentric_rfd concentric_rfd_100ms
## Min. : 1.0 Min. :0.1048 Min. : 0 Min. :-24166
## 1st Qu.:121.2 1st Qu.:0.1955 1st Qu.: 731 1st Qu.: -4548
## Median :241.5 Median :0.2221 Median : 1630 Median : -2809
## Mean :241.5 Mean :0.2287 Mean : 2269 Mean : -3236
## 3rd Qu.:361.8 3rd Qu.:0.2558 3rd Qu.: 3094 3rd Qu.: -1332
## Max. :482.0 Max. :0.4268 Max. :17800 Max. : 5077
## countermovement_depth eccentric_mean_power_bm eccentric_peak_force_bm
## Min. :-49.17 Min. :3.279 Min. :19.56
## 1st Qu.:-31.96 1st Qu.:5.912 1st Qu.:26.48
## Median :-27.10 Median :6.577 Median :28.76
## Mean :-27.71 Mean :6.614 Mean :29.40
## 3rd Qu.:-23.55 3rd Qu.:7.267 3rd Qu.:31.51
## Max. :-11.61 Max. :9.486 Max. :52.03
## force_at_zero_velocity jump_height_cm peak_power_bm positive_impulse
## Min. :1139 Min. :24.42 Min. :39.92 Min. : 378.2
## 1st Qu.:2175 1st Qu.:36.03 1st Qu.:55.79 1st Qu.: 559.6
## Median :2505 Median :41.06 Median :60.81 Median : 708.1
## Mean :2511 Mean :41.18 Mean :61.20 Mean : 694.5
## 3rd Qu.:2829 3rd Qu.:46.24 3rd Qu.:66.51 3rd Qu.: 815.9
## Max. :4582 Max. :61.41 Max. :92.66 Max. :1231.6
## total_work
## Min. : 428.8
## 1st Qu.: 727.6
## Median : 906.4
## Mean : 899.6
## 3rd Qu.:1042.4
## Max. :1821.5
corr_mat <- cor(num_vars, use = "pairwise.complete.obs")
corrplot(corr_mat, method = "color", type = "upper",
tl.cex = 0.8, addCoef.col = "black", number.cex = 0.6)
cors_with_target <- tibble(
variable = setdiff(names(num_vars), "jump_height_cm"),
r = corr_mat[setdiff(names(num_vars), "jump_height_cm"), "jump_height_cm"]
) %>%
arrange(desc(abs(r)))
print(cors_with_target)
## # A tibble: 11 × 2
## variable r
## <chr> <dbl>
## 1 positive_impulse 0.669
## 2 peak_power_bm 0.658
## 3 total_work 0.654
## 4 eccentric_mean_power_bm 0.501
## 5 x1 0.498
## 6 force_at_zero_velocity 0.410
## 7 countermovement_depth -0.346
## 8 concentric_rfd -0.189
## 9 eccentric_peak_force_bm 0.136
## 10 braking_phase_duration -0.0547
## 11 concentric_rfd_100ms 0.0435
predictor <- cors_with_target %>% slice_max(abs(r), n = 1) %>% pull(variable)
cat("Variable predictora elegida automáticamente:", predictor, "\n")
## Variable predictora elegida automáticamente: positive_impulse
data_model <- df %>% select(jump_height_cm, all_of(predictor)) %>% drop_na()
f <- as.formula(paste("jump_height_cm ~", predictor))
model <- lm(f, data = data_model)
summary(model)
##
## Call:
## lm(formula = f, data = data_model)
##
## Residuals:
## Min 1Q Median 3Q Max
## -17.2780 -3.5503 -0.3116 2.9595 15.2624
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 19.865360 1.106595 17.95 <2e-16 ***
## positive_impulse 0.030696 0.001557 19.72 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.179 on 480 degrees of freedom
## Multiple R-squared: 0.4475, Adjusted R-squared: 0.4464
## F-statistic: 388.8 on 1 and 480 DF, p-value: < 2.2e-16
ggplot(data_model, aes_string(x = predictor, y = "jump_height_cm")) +
geom_point(alpha = 0.6, color = "darkblue") +
geom_smooth(method = "lm", se = TRUE, color = "red", linewidth = 1) +
labs(title = paste("Relación entre", predictor, "y Jump Height"),
x = predictor, y = "Altura de salto (cm)") +
theme_minimal()
par(mfrow = c(2, 2))
plot(model)
par(mfrow = c(1, 1))
bp <- bptest(model)
sh <- shapiro.test(resid(model))
cat("\n=== DIAGNÓSTICO DEL MODELO ===\n")
##
## === DIAGNÓSTICO DEL MODELO ===
if (bp$p.value < 0.05) {
cat("⚠️ Heterocedasticidad detectada (p =", round(bp$p.value, 4), ")\n")
} else {
cat("✅ Homocedasticidad cumplida (p =", round(bp$p.value, 4), ")\n")
}
## ⚠️ Heterocedasticidad detectada (p = 0 )
if (sh$p.value > 0.05) {
cat("✅ Residuos normales (p =", round(sh$p.value, 4), ")\n")
} else {
cat("⚠️ Residuos no normales (p =", round(sh$p.value, 4), ")\n")
}
## ⚠️ Residuos no normales (p = 0.0396 )
train_control <- trainControl(method = "cv", number = 10)
cv_model <- train(f, data = data_model, method = "lm", trControl = train_control)
cv_model$results
cat("\n=== RESULTADOS DEL MODELO ===\n")
##
## === RESULTADOS DEL MODELO ===
cat("Variable dependiente: Jump Height (Flight Time)\n")
## Variable dependiente: Jump Height (Flight Time)
cat("Predictor:", predictor, "\n")
## Predictor: positive_impulse
cat("Pendiente:", round(coef(model)[2], 4), "\n")
## Pendiente: 0.0307
cat("R²:", round(summary(model)$r.squared, 4), "\n")
## R²: 0.4475
cat("p-valor:", round(summary(model)$coefficients[2, 4], 4), "\n")
## p-valor: 0
if(summary(model)$coefficients[2,4] < 0.05){
cat("➡️ Relación significativa (p < 0.05)\n")
} else {
cat("⚠️ Relación no significativa (p ≥ 0.05)\n")
}
## ➡️ Relación significativa (p < 0.05)
cat("\nInterpretación práctica:\n")
##
## Interpretación práctica:
cat("Un aumento de una unidad en", predictor,
"se asocia con un cambio promedio de",
round(coef(model)[2], 2), "cm en la altura de salto (Jump Height).\n")
## Un aumento de una unidad en positive_impulse se asocia con un cambio promedio de 0.03 cm en la altura de salto (Jump Height).
broom::tidy(model) %>%
select(term, estimate, std.error, statistic, p.value) %>%
mutate(across(where(is.numeric), round, 3)) %>%
gt() %>%
gt::tab_header(
title = "Resumen del Modelo Lineal Simple - CMJ",
subtitle = paste("Variable predictora:", predictor)
) %>%
gt::cols_label(
term = "Término",
estimate = "Coeficiente",
std.error = "Error estándar",
statistic = "Estadístico t",
p.value = "p-valor"
)
| Resumen del Modelo Lineal Simple - CMJ | ||||
| Variable predictora: positive_impulse | ||||
| Término | Coeficiente | Error estándar | Estadístico t | p-valor |
|---|---|---|---|---|
| (Intercept) | 19.865 | 1.107 | 17.952 | 0 |
| positive_impulse | 0.031 | 0.002 | 19.718 | 0 |
El modelo lineal simple permitió identificar la relación entre una
variable biomecánica y la altura del salto CMJ.
Los resultados entregan información útil para comprender los factores de
desempeño y orientar intervenciones en entrenamiento físico.