IALSA / IALSA-2015-Portland

Hub to accompany IALSA 2015 workshop at Portland, OR, Feb 22-25, 2015
GNU General Public License v2.0
2 stars 0 forks source link

Table Compilations Workflow #143

Open andkov opened 8 years ago

andkov commented 8 years ago

Primary stage

After estimating equivalent forms of statistical models against the data from individual longitudinal studies participating in the current CAR workshop, model outputs (stored in .out files generated by MPlus) are uploaded to the shared folder. The following three scripts process these model results, preparing them for secondary analysis.

After parsing results from all submitted models, correcting input, and computing additional indices, we arrived at the secondary analysis stage, in which the results of of the models will be tabulated and organized according to the current research agenda. The following scripts start from the same point and arrive at different information displays of tabulated results:

image

andkov commented 8 years ago

consider renaming clean+ into augment

andkov commented 8 years ago

knitr::kable(slice)

process label block digit_tot symbol trailsb pef
a Intercept 345.28(25.90), p<.01 347.88(25.15), p<.01 338.88(25.75), p<.01 344.53(25.99), p<.01 344.14(3.79)
a Slope -28.93(6.91), p<.01 -30.34(5.91), p<.01 -25.21(8.42), p<.01 -28.33(7.03), p<.01 -28.20(2.17)
a Intercept * age -4.31(1.82), p=.02 -4.47(1.77), p=.01 -4.13(1.83), p=.02 -4.25(1.88), p=.02 -4.29(0.14)
a Intercept * education -2.15(2.73), p=.43 -2.20(2.86), p=.44 -1.63(2.76), p=.56 -2.10(2.56), p=.41 -2.02(0.26)
a Intercept * height 0.46(1.28), p=.72 0.46(1.23), p=.71 0.26(1.21), p=.83 0.48(1.22), p=.69 0.42(0.11)
a Intercept * smoking -0.55(13.18), p=.97 -0.64(15.29), p=.97 -0.14(15.61), p=.99 -0.34(15.66), p=.98 -0.42(0.22)
a Intercept * cardio -21.32(33.26), p=.52 -22.46(28.88), p=.44 -23.26(31.20), p=.46 -21.55(29.27), p=.46 -22.15(0.89)
a Intercept * diabetes -26.31(25.74), p=.31 -26.06(25.15), p=.30 -22.93(25.83), p=.38 -26.56(24.53), p=.28 -25.47(1.70)
a Slope * age 0.18(0.43), p=.68 0.28(0.44), p=.53 0.10(0.62), p=.88 0.14(0.54), p=.80 0.17(0.08)
a Slope * education 0.74(0.77), p=.34 0.74(0.72), p=.30 0.38(0.94), p=.68 0.68(0.74), p=.36 0.64(0.17)
a Slope * height 0.60(0.26), p=.02 0.59(0.29), p=.04 0.68(0.41), p=.09 0.57(0.27), p=.04 0.61(0.05)
a Slope * smoking 1.91(2.63), p=.47 1.97(2.98), p=.51 1.74(4.92), p=.72 1.89(3.69), p=.61 1.88(0.10)
a Slope * cardio 2.32(10.07), p=.82 3.51(9.70), p=.72 3.28(12.12), p=.79 2.45(9.40), p=.79 2.89(0.59)
a Slope * diabetes -0.53(8.71), p=.95 -0.57(6.70), p=.93 -2.34(9.13), p=.80 -0.31(8.60), p=.97 -0.94(0.94)
b Intercept 18.99(2.49), p<.01 13.64(0.96), p<.01 40.61(3.40), p<.01 163.08(21.45), p<.01 ---
b Slope 0.78(0.47), p=.10 0.24(0.19), p=.19 0.60(0.68), p=.38 2.91(6.20), p=.64 ---
b Intercept * age -0.15(0.16), p=.37 -0.07(0.07), p=.30 -0.38(0.27), p=.17 1.81(1.45), p=.21 ---
b Intercept * education 0.88(0.26), p<.01 0.28(0.09), p<.01 1.79(0.36), p<.01 -7.22(2.22), p<.01 ---
b Intercept * height -0.01(0.11), p=.91 0.03(0.04), p=.56 0.05(0.19), p=.78 0.10(0.88), p=.91 ---
b Intercept * smoking 1.52(1.44), p=.29 0.41(0.52), p=.43 2.19(1.95), p=.26 -11.54(10.43), p=.27 ---
b Intercept * cardio -0.38(2.66), p=.89 -0.33(1.10), p=.76 -4.95(8.14), p=.54 26.85(19.19), p=.16 ---
b Intercept * diabetes -4.39(2.60), p=.09 -1.59(0.82), p=.05 -6.73(2.75), p=.01 31.07(16.68), p=.06 ---
b Slope * age -0.04(0.03), p=.18 -0.01(0.02), p=.34 -0.06(0.04), p=.09 0.20(0.34), p=.56 ---
b Slope * education -0.07(0.05), p=.17 -0.02(0.02), p=.34 -0.06(0.08), p=.44 -0.11(0.62), p=.86 ---
b Slope * height -0.01(0.02), p=.66 -0.01(0.01), p=.17 0.01(0.04), p=.89 -0.00(0.21), p=.98 ---
b Slope * smoking -0.10(0.28), p=.72 -0.02(0.12), p=.88 0.09(0.45), p=.83 -0.32(2.73), p=.91 ---
b Slope * cardio -0.07(0.77), p=.93 -0.11(0.36), p=.76 0.00(1.34), p=.99 -1.92(6.48), p=.77 ---
b Slope * diabetes 0.18(0.44), p=.69 0.06(0.15), p=.70 -0.26(0.52), p=.63 2.62(4.55), p=.56 ---
aa Intercept 4619.53(1051.84), p<.01 4601.03(1104.55), p<.01 4709.73(1105.26), p<.01 4630.56(1107.26), p<.01 ---
aa Slope 37.57(29.43), p=.20 32.13(28.48), p=.26 103.05(66.91), p=.12 39.51(32.43), p=.22 ---
a Residual 1701.95(104.59), p<.01 1703.62(122.04), p<.01 1625.48(95.71), p<.01 1693.29(88.95), p<.01 1681.09(37.34)
bb Intercept 46.29(9.11), p<.01 5.85(1.38), p<.01 112.32(20.21), p<.01 2356.32(716.30), p<.01 ---
bb Slope 0.14(0.24), p=.55 0.05(0.04), p=.18 0.30(0.55), p=.59 5.91(19.07), p=.76 ---
b Residual 19.77(1.57), p<.01 2.39(0.23), p<.01 28.80(2.19), p<.01 1475.27(76.02), p<.01 ---
ab Intercept(a) - Intercept(b) 86.03(78.62), p=.27 -24.44(27.64), p=.38 215.86(120.89), p=.07 -781.69(661.61), p=.24 ---
ab Slope(a) - Slope(b) 0.36(2.06), p=.86 -0.61(0.96), p=.53 2.80(4.40), p=.52 -0.54(29.25), p=.98 ---
aa Intercept(a) - Slope(a) -303.65(136.78), p=.03 -281.39(136.38), p=.04 -390.70(223.92), p=.08 -306.53(168.09), p=.07 ---
bb Intercept(b) - Slope(b) -0.93(1.45), p=.52 0.03(0.16), p=.84 -1.71(2.88), p=.55 44.85(135.15), p=.74 ---
wibeasley commented 8 years ago

Some code adapted from REDCapR to calculate the positions of the colums to show in each subtable (after it's been split to fit on a printed page).

batch_size <- 6 #Only show six studies in each printed table.
left_side <- c("a", "b")
column_names <- letters[1:20]
outcome_columns <- setdiff(column_names, left_side)#Pretend these are the names of the outcome columns

column_outcome_count <- length(outcome_columns)

start_index <- base::seq.int(from=1, to=column_outcome_count, by=batch_size)

ds_batch <- data.frame(
  id             = seq_along(start_index), 
  start_index    = start_index
)

ds_batch$stop_index  <- base::mapply(
  function(i) base::ifelse(i<length(start_index), start_index[i+1]-1, column_outcome_count),
  ds_batch$id 
)
> ds_batch
  id start_index stop_index
1  1           1          6
2  2           7         12
3  3          13         18