loading libraries
library(psych)
library(report)
Reading in data
FinalData <- read.csv("wpa_lena_pos.csv")
Subsetting variables of interest
df <- FinalData[,1:8]
Aggregating sitting time variable
sit_mean <- aggregate(df$sit_time, by=list(df$id_uni), FUN=mean)
names(sit_mean)[names(sit_mean) == "Group.1"] <- "UniqueID"
names(sit_mean)[names(sit_mean) == "x"] <- "sit_ave"
Eliminating duplicates and merging data frames
df1 <- df[!duplicated(df$id_uni),]
df1.5 <- merge(sit_mean, df1, by.x = "UniqueID", by.y = "id_uni")
Aggregating held time variable
held_mean <- aggregate(df$held_time, by=list(df$id_uni), FUN=mean)
names(held_mean)[names(held_mean) == "Group.1"] <- "UniqueID"
names(held_mean)[names(held_mean) == "x"] <- "held_ave"
Merging data frames (df1.5 with held time data frame)
df2 <- merge(held_mean, df1.5, by.x = "UniqueID", by.y = "UniqueID")
Aggregating prone variable
prone_mean <- aggregate(df$prone_time, by=list(df$id_uni), FUN=mean)
names(prone_mean)[names(prone_mean) == "Group.1"] <- "UniqueID"
names(prone_mean)[names(prone_mean) == "x"] <- "prone_ave"
Merging data frames (df2 with held prone data frame)
df3 <- merge(prone_mean, df2, by.x = "UniqueID", by.y = "UniqueID")
Aggregating supine variable
supine_mean <- aggregate(df$supine_time, by=list(df$id_uni), FUN=mean)
names(supine_mean)[names(supine_mean) == "Group.1"] <- "UniqueID"
names(supine_mean)[names(supine_mean) == "x"] <- "supine_ave"
Merging data frames (df3 with held supine data frame)
df4 <- merge(supine_mean, df3, by.x = "UniqueID", by.y = "UniqueID")
Aggregating upright variable
upright_mean <- aggregate(df$upright_time, by=list(df$id_uni), FUN=mean)
names(upright_mean)[names(upright_mean) == "Group.1"] <- "UniqueID"
names(upright_mean)[names(upright_mean) == "x"] <- "upright_ave"
Merging data frames (df4 with upright data frame)
df5 <- merge(upright_mean, df4, by.x = "UniqueID", by.y = "UniqueID")
Aggregating adult word count variable
adult_word_count_mean <- aggregate(df$adult_word_cnt, by=list(df$id_uni), FUN=mean)
names(adult_word_count_mean)[names(adult_word_count_mean) == "Group.1"] <- "UniqueID"
names(adult_word_count_mean)[names(adult_word_count_mean) == "x"] <- "adult_word_count_ave"
Merging data frames (df5 with adult word count data frame)
df6 <- merge(adult_word_count_mean, df5, by.x = "UniqueID", by.y = "UniqueID")
Subsetting final variables of interest
df_final <- df6[,-c(9:14)]
Descriptive statistics on all variables
describe(df_final$sit_ave)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 11 0.52 0.12 0.54 0.52 0.09 0.3 0.69 0.39 -0.28 -1.16 0.04
describe(df_final$held_ave)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 11 0.08 0.05 0.06 0.07 0.05 0.02 0.16 0.14 0.66 -1.04 0.01
describe(df_final$prone_ave)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 11 0.14 0.07 0.14 0.13 0.06 0.06 0.28 0.22 0.85 -0.44 0.02
describe(df_final$supine_ave)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 11 0.11 0.07 0.11 0.11 0.1 0.02 0.2 0.18 -0.09 -1.75 0.02
describe(df_final$upright_ave)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 11 0.16 0.06 0.16 0.16 0.07 0.07 0.26 0.19 0.08 -1.25 0.02
describe(df_final$adult_word_count_ave)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 11 243 74.5 246.8 235.43 66.95 150.65 403.38 252.73 0.6 -0.52
## se
## X1 22.46
correlation between time spent sitting and adult word count
correlation_sitting <- corr.test(df_final$sit_ave, df_final$adult_word_count_ave)
print(correlation_sitting, short = F)
## Call:corr.test(x = df_final$sit_ave, y = df_final$adult_word_count_ave)
## Correlation matrix
## [1] 0.24
## Sample Size
## [1] 11
## These are the unadjusted probability values.
## The probability values adjusted for multiple tests are in the p.adj object.
## [1] 0.47
##
## Confidence intervals based upon normal theory. To get bootstrapped values, try cor.ci
## raw.lower raw.r raw.upper raw.p lower.adj upper.adj
## NA-NA -0.42 0.24 0.73 0.47 -0.42 0.73
plot(df_final$sit_ave, df_final$adult_word_count_ave)
correlation between time spent held and adult word count
correlation_held <- corr.test(df_final$held_ave, df_final$adult_word_count_ave)
print(correlation_held, short = F)
## Call:corr.test(x = df_final$held_ave, y = df_final$adult_word_count_ave)
## Correlation matrix
## [1] 0.11
## Sample Size
## [1] 11
## These are the unadjusted probability values.
## The probability values adjusted for multiple tests are in the p.adj object.
## [1] 0.75
##
## Confidence intervals based upon normal theory. To get bootstrapped values, try cor.ci
## raw.lower raw.r raw.upper raw.p lower.adj upper.adj
## NA-NA -0.52 0.11 0.67 0.75 -0.52 0.67
plot(df_final$held_ave, df_final$adult_word_count_ave)
correlation between time spent prone and adult word count
correlation_prone <- corr.test(df_final$prone_ave, df_final$adult_word_count_ave)
print(correlation_prone, short = F)
## Call:corr.test(x = df_final$prone_ave, y = df_final$adult_word_count_ave)
## Correlation matrix
## [1] 0.04
## Sample Size
## [1] 11
## These are the unadjusted probability values.
## The probability values adjusted for multiple tests are in the p.adj object.
## [1] 0.9
##
## Confidence intervals based upon normal theory. To get bootstrapped values, try cor.ci
## raw.lower raw.r raw.upper raw.p lower.adj upper.adj
## NA-NA -0.57 0.04 0.63 0.9 -0.57 0.63
plot(df_final$prone_ave, df_final$adult_word_count_ave)
correlation between time spent supine and adult word count
correlation_supine <- corr.test(df_final$supine_ave, df_final$adult_word_count_ave)
print(correlation_supine, short = F)
## Call:corr.test(x = df_final$supine_ave, y = df_final$adult_word_count_ave)
## Correlation matrix
## [1] -0.24
## Sample Size
## [1] 11
## These are the unadjusted probability values.
## The probability values adjusted for multiple tests are in the p.adj object.
## [1] 0.48
##
## Confidence intervals based upon normal theory. To get bootstrapped values, try cor.ci
## raw.lower raw.r raw.upper raw.p lower.adj upper.adj
## NA-NA -0.73 -0.24 0.42 0.48 -0.73 0.42
plot(df_final$supine_ave, df_final$adult_word_count_ave)
correlation between time spent upright and adult word count
correlation_upright <- corr.test(df_final$upright_ave, df_final$adult_word_count_ave)
print(correlation_upright, short = F)
## Call:corr.test(x = df_final$upright_ave, y = df_final$adult_word_count_ave)
## Correlation matrix
## [1] -0.34
## Sample Size
## [1] 11
## These are the unadjusted probability values.
## The probability values adjusted for multiple tests are in the p.adj object.
## [1] 0.31
##
## Confidence intervals based upon normal theory. To get bootstrapped values, try cor.ci
## raw.lower raw.r raw.upper raw.p lower.adj upper.adj
## NA-NA -0.78 -0.34 0.33 0.31 -0.78 0.33
plot(df_final$upright_ave, df_final$adult_word_count_ave)
regression: time spent sitting as a predictor of adult word count
regression_sitting <- lm(adult_word_count_ave~sit_ave, data=df_final)
summary(regression_sitting)
##
## Call:
## lm(formula = adult_word_count_ave ~ sit_ave, data = df_final)
##
## Residuals:
## Min 1Q Median 3Q Max
## -97.738 -39.603 -5.958 29.051 163.943
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 164.3 107.8 1.525 0.162
## sit_ave 152.7 204.4 0.747 0.474
##
## Residual standard error: 76.21 on 9 degrees of freedom
## Multiple R-squared: 0.05836, Adjusted R-squared: -0.04627
## F-statistic: 0.5578 on 1 and 9 DF, p-value: 0.4742
report(regression_sitting)
## We fitted a linear model (estimated using OLS) to predict adult_word_count_ave
## with sit_ave (formula: adult_word_count_ave ~ sit_ave). The model explains a
## statistically not significant and weak proportion of variance (R2 = 0.06, F(1,
## 9) = 0.56, p = 0.474, adj. R2 = -0.05). The model's intercept, corresponding to
## sit_ave = 0, is at 164.34 (95% CI [-79.51, 408.19], t(9) = 1.52, p = 0.162).
## Within this model:
##
## - The effect of sit ave is statistically non-significant and positive (beta =
## 152.67, 95% CI [-309.76, 615.11], t(9) = 0.75, p = 0.474; Std. beta = 0.24, 95%
## CI [-0.49, 0.97])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
regression: time spent held as a predictor of adult word count
regression_held <- lm(adult_word_count_ave~held_ave, data=df_final)
summary(regression_held)
##
## Call:
## lm(formula = adult_word_count_ave ~ held_ave, data = df_final)
##
## Residuals:
## Min 1Q Median 3Q Max
## -105.872 -45.105 1.572 31.289 156.894
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 229.2 47.4 4.836 0.000926 ***
## held_ave 176.0 526.4 0.334 0.745743
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 78.05 on 9 degrees of freedom
## Multiple R-squared: 0.01227, Adjusted R-squared: -0.09748
## F-statistic: 0.1118 on 1 and 9 DF, p-value: 0.7457
report(regression_held)
## We fitted a linear model (estimated using OLS) to predict adult_word_count_ave
## with held_ave (formula: adult_word_count_ave ~ held_ave). The model explains a
## statistically not significant and very weak proportion of variance (R2 = 0.01,
## F(1, 9) = 0.11, p = 0.746, adj. R2 = -0.10). The model's intercept,
## corresponding to held_ave = 0, is at 229.24 (95% CI [122.01, 336.47], t(9) =
## 4.84, p < .001). Within this model:
##
## - The effect of held ave is statistically non-significant and positive (beta =
## 176.02, 95% CI [-1014.76, 1366.80], t(9) = 0.33, p = 0.746; Std. beta = 0.11,
## 95% CI [-0.64, 0.86])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
regression: time spent prone as a predictor of adult word count
regression_prone <- lm(adult_word_count_ave~prone_ave, data=df_final)
summary(regression_prone)
##
## Call:
## lm(formula = adult_word_count_ave ~ prone_ave, data = df_final)
##
## Residuals:
## Min 1Q Median 3Q Max
## -92.846 -51.598 3.714 37.921 155.758
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 236.14 57.04 4.140 0.00252 **
## prone_ave 49.80 377.22 0.132 0.89788
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 78.46 on 9 degrees of freedom
## Multiple R-squared: 0.001933, Adjusted R-squared: -0.109
## F-statistic: 0.01743 on 1 and 9 DF, p-value: 0.8979
report(regression_prone)
## We fitted a linear model (estimated using OLS) to predict adult_word_count_ave
## with prone_ave (formula: adult_word_count_ave ~ prone_ave). The model explains
## a statistically not significant and very weak proportion of variance (R2 =
## 1.93e-03, F(1, 9) = 0.02, p = 0.898, adj. R2 = -0.11). The model's intercept,
## corresponding to prone_ave = 0, is at 236.14 (95% CI [107.10, 365.19], t(9) =
## 4.14, p = 0.003). Within this model:
##
## - The effect of prone ave is statistically non-significant and positive (beta =
## 49.80, 95% CI [-803.53, 903.13], t(9) = 0.13, p = 0.898; Std. beta = 0.04, 95%
## CI [-0.71, 0.80])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
regression: time spent supine as a predictor of adult word count
regression_supine <- lm(adult_word_count_ave~supine_ave, data=df_final)
summary(regression_supine)
##
## Call:
## lm(formula = adult_word_count_ave ~ supine_ave, data = df_final)
##
## Residuals:
## Min 1Q Median 3Q Max
## -113.36 -35.28 -11.52 33.60 160.12
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 272.5 45.9 5.938 0.000219 ***
## supine_ave -266.1 358.0 -0.743 0.476319
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 76.23 on 9 degrees of freedom
## Multiple R-squared: 0.05782, Adjusted R-squared: -0.04687
## F-statistic: 0.5523 on 1 and 9 DF, p-value: 0.4763
report(regression_supine)
## We fitted a linear model (estimated using OLS) to predict adult_word_count_ave
## with supine_ave (formula: adult_word_count_ave ~ supine_ave). The model
## explains a statistically not significant and weak proportion of variance (R2 =
## 0.06, F(1, 9) = 0.55, p = 0.476, adj. R2 = -0.05). The model's intercept,
## corresponding to supine_ave = 0, is at 272.52 (95% CI [168.69, 376.35], t(9) =
## 5.94, p < .001). Within this model:
##
## - The effect of supine ave is statistically non-significant and negative (beta
## = -266.07, 95% CI [-1075.93, 543.80], t(9) = -0.74, p = 0.476; Std. beta =
## -0.24, 95% CI [-0.97, 0.49])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
regression: time spent upright as a predictor of adult word count
regression_upright <- lm(adult_word_count_ave~upright_ave, data=df_final)
summary(regression_upright)
##
## Call:
## lm(formula = adult_word_count_ave ~ upright_ave, data = df_final)
##
## Residuals:
## Min 1Q Median 3Q Max
## -123.429 -51.857 5.907 42.177 123.975
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 307.99 64.83 4.751 0.00104 **
## upright_ave -411.15 385.06 -1.068 0.31344
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 73.99 on 9 degrees of freedom
## Multiple R-squared: 0.1124, Adjusted R-squared: 0.01381
## F-statistic: 1.14 on 1 and 9 DF, p-value: 0.3134
report(regression_upright)
## We fitted a linear model (estimated using OLS) to predict adult_word_count_ave
## with upright_ave (formula: adult_word_count_ave ~ upright_ave). The model
## explains a statistically not significant and weak proportion of variance (R2 =
## 0.11, F(1, 9) = 1.14, p = 0.313, adj. R2 = 0.01). The model's intercept,
## corresponding to upright_ave = 0, is at 307.99 (95% CI [161.34, 454.63], t(9) =
## 4.75, p = 0.001). Within this model:
##
## - The effect of upright ave is statistically non-significant and negative (beta
## = -411.15, 95% CI [-1282.23, 459.93], t(9) = -1.07, p = 0.313; Std. beta =
## -0.34, 95% CI [-1.05, 0.38])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.