-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSCAscript.R
67 lines (56 loc) · 1.92 KB
/
NSCAscript.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
library(readxl)
BJ <- read_excel("Track_Data.xlsx",
sheet = "Bilateral")
View(BJ)
attach(BJ)
##Regression model
model <- lm(Accel30 ~ Distance, data = BJ)
model
summary(model)
library(ggplot2)
library(ggpubr)
ggplot(BJ, aes(y = Accel30, x = Distance)) +
labs(x = "Acceleration 30-meter time (s)", y = "Distance (m)") +
geom_point() + theme_classic() +
stat_smooth(method = "lm") +
stat_regline_equation(label.x = 270, label.y = 5.5,
aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~")))
ggsave("BJ_Distance.png")
##BOMBT data
library(readxl)
BOMBT <- read_excel("Track_Data.xlsx",
sheet = "BOMBT")
View(BOMBT)
attach(BOMBT)
##Regression model 2, not a significant model for BOMBT using distance
model2 <- lm(Accel30 ~ Distance, data = BOMBT)
model2
summary(model2)
ggplot(BOMBT, aes(y = Accel30, x = Distance)) +
labs(y = "Acceleration 30-meter completion time (s)", x = "Distance (m)") +
geom_point() + theme_classic() +
stat_smooth(method = "lm") +
stat_regline_equation(label.x = 14, label.y = 5.5,
aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~")))
ggsave("BOMBT_Distance.png")
##Model 3, good model for BOMBT using peak force (PF)
model3 <- lm(Accel30 ~ PF, data = BOMBT)
model3
summary(model3)
ggplot(BOMBT, aes(y = Accel30, x = PF)) +
labs(y = "Acceleration 30-meter time (s)", x = "Peak Force (n/kg)") +
geom_point() + theme_classic() +
stat_smooth(method = "lm") +
stat_regline_equation(label.x = 2.3, label.y = 5.5,
aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~")))
ggsave("BOMBT_PeakForce.png")
##Subject descriptives
library(psych)
library(dplyr)
## Change Height to meters / 100 and then obtain BMI (Kg/m2)
BJ <- mutate(BJ, Height = Height/100) %>%
mutate(BJ, BMI = Weight / (Height^2))
##describe all subjects mean and sd
BJ %>% describe()
##describe subjects by sex
BJ %>% describeBy(Gender)