R Under development (unstable) (2024-01-29 r85841 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # install the package and use this script to test the package > library("APCI") > # or: remotes::install_github("jiahui1902/APCI") > test_data <- APCI::women9017 > test_data$acc <- as.factor(test_data$acc) > test_data$pcc <- as.factor(test_data$pcc) > test_data$educc <- as.factor(test_data$educc) > test_data$educr <- as.factor(test_data$educr) > > # equal age and period interval > APC_I <- APCI::apci(outcome = "inlfc", + age = "acc", + period = "pcc", + cohort = "ccc", + weight = "wt", + data = test_data,dev.test=FALSE, + print = TRUE, + family = "gaussian") inlfc ~ acc * pcc Intercept: estimate se p sig 1 0.723 0.016 0.000 *** Age Effect: age_group age_estimate age_se age_p age_sig 1 1 -0.023 0.047 0.621 2 2 0.040 0.051 0.429 3 3 0.105 0.036 0.004 ** 4 4 0.073 0.038 0.054 5 5 0.077 0.041 0.063 6 6 0.097 0.043 0.024 * 7 7 0.014 0.042 0.734 8 8 -0.049 0.050 0.324 9 9 -0.334 0.056 0.000 *** Period Effect: period_group period_estimate period_se period_p period_sig 1 1 -0.037 0.041 0.364 2 2 0.082 0.036 0.021 * 3 3 -0.032 0.031 0.288 4 4 0.035 0.031 0.262 5 5 -0.041 0.037 0.266 6 6 -0.007 0.039 0.859 Cohort Deviation: cohort_average_group cohort_average cohort_average_se cohort_average_t 1 1 0.040 0.146 0.276 2 2 -0.166 0.111 -1.499 3 3 -0.004 0.063 -0.060 4 4 0.136 0.058 2.358 5 5 -0.085 0.049 -1.735 6 6 -0.016 0.044 -0.363 7 7 0.056 0.035 1.621 8 8 0.024 0.033 0.728 9 9 -0.001 0.038 -0.019 10 10 0.016 0.044 0.362 11 11 -0.036 0.049 -0.726 12 12 -0.064 0.074 -0.862 13 13 0.006 0.080 0.071 14 14 0.045 0.135 0.332 cohort_average_p cohort_average_sig 1 0.783 2 0.134 3 0.952 4 0.019 * 5 0.083 6 0.717 7 0.105 8 0.467 9 0.985 10 0.717 11 0.468 12 0.389 13 0.943 14 0.740 Cohort Life Course Dynamics: cohort_slope_group cohort_slope cohort_slope_se cohort_slope_t 1 1 NA NA NA 2 2 0.087 0.151 0.574 3 3 -0.005 0.117 -0.047 4 4 0.372 0.121 3.067 5 5 -0.207 0.098 -2.112 6 6 -0.084 0.102 -0.819 7 7 0.101 0.086 1.163 8 8 -0.102 0.084 -1.206 9 9 0.007 0.083 0.084 10 10 0.034 0.106 0.321 11 11 0.002 0.097 0.022 12 12 0.043 0.094 0.455 13 13 -0.096 0.104 -0.929 14 14 NA NA NA cohort_slope_p cohort_slope_sig 1 NA 2 0.566 3 0.963 4 0.002 ** 5 0.035 * 6 0.413 7 0.245 8 0.228 9 0.933 10 0.749 11 0.982 12 0.649 13 0.353 14 NA > summary(APC_I) Length Class Mode model 34 svyglm list dev_global 0 -none- NULL intercept 4 -none- character age_effect 45 -none- character period_effect 30 -none- character cohort_average 6 data.frame list cohort_slope 6 data.frame list int_matrix 5 data.frame list cohort_index 54 -none- numeric data 23 data.frame list > > APC_I$model$coefficients (Intercept) acc1 acc2 acc3 acc4 acc5 0.722823721 -0.023136361 0.040013754 0.104541041 0.073303652 0.076670235 acc6 acc7 acc8 pcc1 pcc2 pcc3 0.097489397 0.014339427 -0.049435166 -0.037227987 0.082244257 -0.032465606 pcc4 pcc5 acc1:pcc1 acc2:pcc1 acc3:pcc1 acc4:pcc1 0.035360547 -0.041063735 0.107855136 0.134505814 0.013080152 0.038193073 acc5:pcc1 acc6:pcc1 acc7:pcc1 acc8:pcc1 acc1:pcc2 acc2:pcc2 0.155871138 -0.138548374 -0.123916766 -0.227203968 -0.102488703 -0.093827942 acc3:pcc2 acc4:pcc2 acc5:pcc2 acc6:pcc2 acc7:pcc2 acc8:pcc2 0.026067418 0.051046947 -0.061070811 -0.111212431 0.151910564 0.244367187 acc1:pcc3 acc2:pcc3 acc3:pcc3 acc4:pcc3 acc5:pcc3 acc6:pcc3 -0.046682319 0.168232251 0.011077909 -0.017826557 0.010408696 0.068786474 acc7:pcc3 acc8:pcc3 acc1:pcc4 acc2:pcc4 acc3:pcc4 acc4:pcc4 -0.156482189 0.094155962 -0.077249961 -0.048079158 -0.051491253 -0.065069323 acc5:pcc4 acc6:pcc4 acc7:pcc4 acc8:pcc4 acc1:pcc5 acc2:pcc5 -0.004133526 -0.029593441 0.007157184 -0.166500416 0.073878255 -0.098389755 acc3:pcc5 acc4:pcc5 acc5:pcc5 acc6:pcc5 acc7:pcc5 acc8:pcc5 0.017733402 0.059110660 -0.107119394 0.067861346 0.185069747 -0.053669159 > summary(APC_I$model) Call: svyglm(formula = temp6_formula, design = wtdata2, family = get(family)) Survey design: survey::svydesign(id = ~1, strata = NULL, data = data2, weights = as.formula(paste0("~", weight))) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.722824 0.016027 45.101 < 2e-16 *** acc1 -0.023136 0.046719 -0.495 0.62056 acc2 0.040014 0.050587 0.791 0.42915 acc3 0.104541 0.035939 2.909 0.00371 ** acc4 0.073304 0.037961 1.931 0.05378 . acc5 0.076670 0.041160 1.863 0.06281 . acc6 0.097489 0.043186 2.257 0.02421 * acc7 0.014339 0.042147 0.340 0.73377 acc8 -0.049435 0.050100 -0.987 0.32403 pcc1 -0.037228 0.040961 -0.909 0.36365 pcc2 0.082244 0.035506 2.316 0.02075 * pcc3 -0.032466 0.030517 -1.064 0.28767 pcc4 0.035361 0.031488 1.123 0.26173 pcc5 -0.041064 0.036866 -1.114 0.26563 acc1:pcc1 0.107855 0.088323 1.221 0.22234 acc2:pcc1 0.134506 0.094547 1.423 0.15517 acc3:pcc1 0.013080 0.085888 0.152 0.87899 acc4:pcc1 0.038193 0.086145 0.443 0.65761 acc5:pcc1 0.155871 0.079288 1.966 0.04960 * acc6:pcc1 -0.138548 0.154952 -0.894 0.37148 acc7:pcc1 -0.123917 0.133879 -0.926 0.35490 acc8:pcc1 -0.227204 0.140806 -1.614 0.10695 acc1:pcc2 -0.102489 0.123326 -0.831 0.40616 acc2:pcc2 -0.093828 0.111254 -0.843 0.39924 acc3:pcc2 0.026067 0.066304 0.393 0.69430 acc4:pcc2 0.051047 0.069410 0.735 0.46226 acc5:pcc2 -0.061071 0.100118 -0.610 0.54202 acc6:pcc2 -0.111212 0.098794 -1.126 0.26058 acc7:pcc2 0.151911 0.057056 2.662 0.00789 ** acc8:pcc2 0.244367 0.059277 4.122 4.08e-05 *** acc1:pcc3 -0.046682 0.086663 -0.539 0.59025 acc2:pcc3 0.168232 0.067884 2.478 0.01338 * acc3:pcc3 0.011078 0.073146 0.151 0.87965 acc4:pcc3 -0.017827 0.072732 -0.245 0.80643 acc5:pcc3 0.010409 0.082186 0.127 0.89925 acc6:pcc3 0.068786 0.072383 0.950 0.34220 acc7:pcc3 -0.156482 0.100332 -1.560 0.11918 acc8:pcc3 0.094156 0.105536 0.892 0.37253 acc1:pcc4 -0.077250 0.092708 -0.833 0.40491 acc2:pcc4 -0.048079 0.091510 -0.525 0.59943 acc3:pcc4 -0.051491 0.070961 -0.726 0.46825 acc4:pcc4 -0.065069 0.078646 -0.827 0.40824 acc5:pcc4 -0.004134 0.065733 -0.063 0.94987 acc6:pcc4 -0.029593 0.087274 -0.339 0.73462 acc7:pcc4 0.007157 0.089854 0.080 0.93653 acc8:pcc4 -0.166500 0.120332 -1.384 0.16679 acc1:pcc5 0.073878 0.090681 0.815 0.41545 acc2:pcc5 -0.098390 0.164649 -0.598 0.55027 acc3:pcc5 0.017733 0.080237 0.221 0.82513 acc4:pcc5 0.059111 0.081654 0.724 0.46930 acc5:pcc5 -0.107119 0.108338 -0.989 0.32304 acc6:pcc5 0.067861 0.071882 0.944 0.34538 acc7:pcc5 0.185070 0.066662 2.776 0.00561 ** acc8:pcc5 -0.053669 0.125209 -0.429 0.66829 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for gaussian family taken to be 0.1675259) Number of Fisher Scoring iterations: 2 > APC_I$dev_global NULL > APC_I$dev_local NULL > APC_I$intercept estimate se p "0.722823721264995" "0.0160266588455221" "9.5996005190467e-238" sig "***" > APC_I$age_effect age_group age_estimate age_se [1,] "1" "-0.023136361077591" "0.0467189865700206" [2,] "2" "0.0400137538851534" "0.0505869371699012" [3,] "3" "0.104541040705761" "0.035939018607914" [4,] "4" "0.0733036516665031" "0.0379605595668322" [5,] "5" "0.0766702345597859" "0.0411600045877691" [6,] "6" "0.0974893973496912" "0.0431859489277772" [7,] "7" "0.0143394267266666" "0.042147470605983" [8,] "8" "-0.0494351655374788" "0.0501000476452751" [9,] "9" "-0.333785978278491" "0.0563343401094491" age_p sig [1,] "0.620557295976925" " " [2,] "0.429148593343231" " " [3,] "0.00371273596349115" "** " [4,] "0.0537762981351436" " " [5,] "0.0628098179708096" " " [6,] "0.0242088241676351" "* " [7,] "0.733766292492727" " " [8,] "0.324028386806769" " " [9,] "4.37020931955974e-09" "***" > APC_I$period_effect period_group period_estimate period_se [1,] "1" "-0.037227987494298" "0.0409606310911546" [2,] "2" "0.0822442574049102" "0.0355057334748146" [3,] "3" "-0.0324656058696508" "0.0305174614114505" [4,] "4" "0.0353605473842638" "0.0314877519936346" [5,] "5" "-0.0410637348638453" "0.0368664711145681" [6,] "6" "-0.00684747656137997" "0.0385389768221606" period_p sig [1,] "0.363649454235801" " " [2,] "0.0207516886707821" "* " [3,] "0.28767457461471" " " [4,] "0.261725687538456" " " [5,] "0.265626875798358" " " [6,] "0.859015035996362" " " > APC_I$cohort_average cohort_group cohort_average cohort_average_se cohort_average_t 1 1 0.0401637946523128 0.145654410499202 0.275747191689282 2 2 -0.165998098269934 0.110732007704118 -1.49909770184508 3 3 -0.00373993589994506 0.0627359414591251 -0.0596139280444492 4 4 0.135619511341992 0.0575231564574465 2.35765072179789 5 5 -0.0845597999766206 0.0487337724678583 -1.73513757902471 6 6 -0.015798227932657 0.0435517907715651 -0.362745771247865 7 7 0.0564770823462887 0.0348308485769292 1.62146730997812 8 8 0.0237893260546683 0.0326982034566164 0.72754229712442 9 9 -0.000729531341517646 0.0377506459702066 -0.0193250028646769 10 10 0.0158813704942078 0.0438719972507362 0.361993332636373 11 11 -0.0356207185155389 0.0490354608253836 -0.726427730380369 12 12 -0.0640357816985939 0.0742918076889194 -0.861949435484592 13 13 0.00571852247977949 0.0800513176721246 0.0714357070698262 14 14 0.0446875910691726 0.134689398365975 0.331782542733976 cohort_average_p sig 1 0.782802468508043 2 0.134181910088998 3 0.952475715770102 4 0.0185937732339823 * 5 0.0830421104761112 6 0.716875833812225 7 0.105250678987751 8 0.467073832032295 9 0.984585913291567 10 0.717437856984917 11 0.467756293668003 12 0.388933779223363 13 0.943066091087778 14 0.740126957575424 > APC_I$cohort_slope cohort_group cohort_slope cohort_slope_se cohort_slope_t 1 1 2 2 0.0865581708070433 0.150720313851626 0.574296646517429 3 3 -0.00548252587219852 0.11730697307554 -0.0467365726730332 4 4 0.37180671996158 0.121228187024816 3.06699893058262 5 5 -0.207439235923212 0.0982093910700732 -2.11221384903204 6 6 -0.0838238142879899 0.102317500605001 -0.819251973438968 7 7 0.100508860836206 0.0864003588542193 1.16329216879518 8 8 -0.101851041311175 0.0844353569025986 -1.20626056485634 9 9 0.00696039732231724 0.0832372302074845 0.0836212029757253 10 10 0.0341347660583372 0.106458987559418 0.320637710736122 11 11 0.0021231724752769 0.0966078090729115 0.0219772345077664 12 12 0.0429795991327735 0.0944515389019701 0.455043926572561 13 13 -0.0963924180967428 0.10377624257321 -0.928848604522776 14 14 cohort_slope_p sig 1 2 0.565903606134681 3 0.962733045596044 4 0.00222368013426539 ** 5 0.0349296876945179 * 6 0.412849008697304 7 0.245004319811083 8 0.228018620420455 9 0.933375299565241 10 0.748555769858807 11 0.982470749951475 12 0.649182047032306 13 0.353204490100309 14 > APC_I$cohort_index [,1] [,2] [,3] [,4] [,5] [,6] [1,] 9 10 11 12 13 14 [2,] 8 9 10 11 12 13 [3,] 7 8 9 10 11 12 [4,] 6 7 8 9 10 11 [5,] 5 6 7 8 9 10 [6,] 4 5 6 7 8 9 [7,] 3 4 5 6 7 8 [8,] 2 3 4 5 6 7 [9,] 1 2 3 4 5 6 > > > apci.plot.raw(data = test_data, outcome_var = "inlfc",age="acc",period="pcc") > apci.plot(data = test_data, outcome_var = "inlfc", age = "acc",model=APC_I, + period = "pcc",type="explore") > > apci.bar(model = APC_I, age = "acc",period = "pcc") Warning message: Removed 13 rows containing missing values (`geom_text()`). > apci.plot.heatmap(model = APC_I, age = "acc",period = "pcc") > apci.plot.hexagram(model = APC_I, age = "acc",period = "pcc", + first_age = 20,first_period = 1990,interval = 5) > apci.plot(data = test_data, outcome_var = "inlfc", age = "acc",model=APC_I, + period = "pcc") > # other type of generalized linear model > APC_I2 <- APCI::apci(outcome = "inlfc", + age = "acc", + period = "pcc", + cohort = "ccc", + weight = "wt", + covariate = "offset(log(educ))", + data = test_data,dev.test=FALSE, + print = TRUE, + family = "poisson") inlfc ~ offset(log(educ)) + acc * pcc Intercept: estimate se p sig 1 -4.742 0.031 0.000 *** Age Effect: age_group age_estimate age_se age_p age_sig 1 1 0.014 0.071 0.849 2 2 0.048 0.070 0.495 3 3 0.146 0.051 0.004 ** 4 4 0.119 0.052 0.023 * 5 5 0.096 0.059 0.106 6 6 0.152 0.065 0.020 * 7 7 0.092 0.083 0.268 8 8 -0.053 0.098 0.585 9 9 -0.612 0.174 0.000 *** Period Effect: period_group period_estimate period_se period_p period_sig 1 1 0.040 0.075 0.596 2 2 0.196 0.073 0.007 ** 3 3 -0.040 0.072 0.574 4 4 0.034 0.050 0.493 5 5 -0.117 0.076 0.127 6 6 -0.114 0.068 0.096 Cohort Deviation: cohort_average_group cohort_average cohort_average_se cohort_average_t 1 1 0.149 0.282 0.528 2 2 -0.020 0.285 -0.070 3 3 -0.007 0.198 -0.036 4 4 0.217 0.106 2.050 5 5 -0.268 0.125 -2.142 6 6 -0.011 0.089 -0.121 7 7 0.082 0.049 1.689 8 8 0.002 0.044 0.036 9 9 -0.023 0.051 -0.456 10 10 0.023 0.063 0.368 11 11 -0.028 0.069 -0.412 12 12 -0.052 0.095 -0.553 13 13 0.046 0.126 0.362 14 14 0.153 0.177 0.865 cohort_average_p cohort_average_sig 1 0.597 2 0.945 3 0.971 4 0.041 * 5 0.032 * 6 0.904 7 0.092 8 0.971 9 0.648 10 0.713 11 0.680 12 0.580 13 0.718 14 0.388 Cohort Life Course Dynamics: cohort_slope_group cohort_slope cohort_slope_se cohort_slope_t 1 1 NA NA NA 2 2 0.376 0.392 0.960 3 3 -0.129 0.386 -0.334 4 4 0.520 0.219 2.374 5 5 -0.577 0.310 -1.863 6 6 -0.094 0.250 -0.378 7 7 0.243 0.126 1.930 8 8 -0.095 0.122 -0.774 9 9 0.049 0.129 0.378 10 10 0.145 0.166 0.873 11 11 -0.017 0.144 -0.120 12 12 -0.022 0.129 -0.169 13 13 -0.083 0.172 -0.481 14 14 NA NA NA cohort_slope_p cohort_slope_sig 1 NA 2 0.337 3 0.738 4 0.018 * 5 0.063 6 0.705 7 0.054 8 0.439 9 0.705 10 0.383 11 0.905 12 0.866 13 0.630 14 NA > > summary(APC_I2) Length Class Mode model 34 svyglm list dev_global 0 -none- NULL intercept 4 -none- character age_effect 45 -none- character period_effect 30 -none- character cohort_average 6 data.frame list cohort_slope 6 data.frame list int_matrix 5 data.frame list cohort_index 54 -none- numeric data 23 data.frame list > > > # unequal age and period interval > uneqal_interval1 <- APCI::apci(outcome = "inlfc", + age = "age", + period = "year", + cohort = "ccc", + weight = "wt", + data = test_data,dev.test=FALSE, + print = TRUE, + family = "gaussian", + unequal_interval = TRUE, + age_range = 20:64, + period_range = 1990:2019, + age_interval = 5, + period_interval = 10) inlfc ~ age * year Intercept: estimate se p sig 1 0.717 0.018 0.000 *** Age Effect: age_group age_estimate age_se age_p age_sig 1 1 -0.014 0.044 0.746 2 2 0.039 0.060 0.518 3 3 0.110 0.037 0.003 ** 4 4 0.082 0.038 0.030 * 5 5 0.075 0.043 0.081 6 6 0.107 0.042 0.012 * 7 7 0.019 0.048 0.687 8 8 -0.079 0.066 0.231 9 9 -0.339 0.061 0.000 *** Period Effect: period_group period_estimate period_se period_p period_sig 1 1 0.017 0.027 0.518 2 2 0.008 0.023 0.731 3 3 -0.025 0.025 0.326 Cohort Deviation: cohort_average_group cohort_average cohort_average_se cohort_average_t 1 1 -0.014 0.095 -0.153 2 2 0.040 0.072 0.553 3 3 -0.052 0.050 -1.023 4 4 -0.026 0.045 -0.576 5 5 0.054 0.034 1.594 6 6 0.042 0.030 1.387 7 7 -0.034 0.034 -0.982 8 8 -0.002 0.038 -0.051 9 9 0.031 0.037 0.824 10 10 -0.081 0.063 -1.299 11 11 0.055 0.064 0.859 cohort_average_p cohort_average_sig 1 0.879 2 0.581 3 0.307 4 0.565 5 0.111 6 0.166 7 0.326 8 0.959 9 0.410 10 0.194 11 0.391 Cohort Life Course Dynamics: cohort_slope_group cohort_slope cohort_slope_se cohort_slope_t 1 1 NA NA NA 2 2 0.134 0.090 1.477 3 3 -0.066 0.076 -0.862 4 4 0.098 0.074 1.329 5 5 0.020 0.057 0.345 6 6 0.013 0.052 0.251 7 7 -0.068 0.060 -1.127 8 8 -0.010 0.065 -0.149 9 9 -0.011 0.059 -0.193 10 10 -0.012 0.081 -0.146 11 11 NA NA NA cohort_slope_p cohort_slope_sig 1 NA 2 0.140 3 0.389 4 0.184 5 0.731 6 0.802 7 0.260 8 0.881 9 0.847 10 0.884 11 NA > uneqal_interval1$cohort_index [,1] [,2] [,3] [1,] 9 10 11 [2,] 8 9 10 [3,] 7 8 9 [4,] 6 7 8 [5,] 5 6 7 [6,] 4 5 6 [7,] 3 4 5 [8,] 2 3 4 [9,] 1 2 3 > > uneqal_interval2 <- APCI::apci(outcome = "inlfc", + age = "age", + period = "year", + cohort = "ccc", + weight = "wt", + data = test_data,dev.test=FALSE, + print = TRUE, + family = "gaussian", + unequal_interval = TRUE, + age_range = 20:64, + period_range = 1990:2019, + age_interval = 10, + period_interval = 5) inlfc ~ age * year Intercept: estimate se p sig 1 0.694 0.018 0.000 *** Age Effect: age_group age_estimate age_se age_p age_sig 1 1 0.033 0.035 0.337 2 2 0.118 0.027 0.000 *** 3 3 0.129 0.029 0.000 *** 4 4 0.024 0.032 0.456 5 5 -0.305 0.051 0.000 *** Period Effect: period_group period_estimate period_se period_p period_sig 1 1 -0.023 0.045 0.616 2 2 0.068 0.045 0.133 3 3 -0.059 0.035 0.088 4 4 0.083 0.033 0.012 * 5 5 -0.046 0.039 0.239 6 6 -0.023 0.042 0.586 Cohort Deviation: cohort_average_group cohort_average cohort_average_se cohort_average_t 1 1 0.025 0.131 0.195 2 2 -0.141 0.093 -1.519 3 3 0.051 0.047 1.076 4 4 0.067 0.040 1.702 5 5 -0.008 0.035 -0.237 6 6 -0.020 0.036 -0.553 7 7 -0.002 0.033 -0.058 8 8 -0.001 0.039 -0.015 9 9 -0.010 0.062 -0.167 10 10 0.007 0.088 0.076 cohort_average_p cohort_average_sig 1 0.846 2 0.129 3 0.282 4 0.089 5 0.812 6 0.580 7 0.954 8 0.988 9 0.867 10 0.939 Cohort Life Course Dynamics: cohort_slope_group cohort_slope cohort_slope_se cohort_slope_t 1 1 NA NA NA 2 2 0.072 0.119 0.606 3 3 -0.118 0.080 -1.470 4 4 0.263 0.069 3.791 5 5 -0.194 0.075 -2.605 6 6 0.026 0.083 0.312 7 7 -0.023 0.062 -0.376 8 8 0.127 0.065 1.964 9 9 -0.008 0.081 -0.102 10 10 NA NA NA cohort_slope_p cohort_slope_sig 1 NA 2 0.544 3 0.142 4 0.000 *** 5 0.009 ** 6 0.755 7 0.707 8 0.050 * 9 0.919 10 NA > uneqal_interval2$cohort_index [,1] [,2] [,3] [,4] [,5] [,6] [1,] 5 6 7 8 9 10 [2,] 4 5 6 7 8 9 [3,] 3 4 5 6 7 8 [4,] 2 3 4 5 6 7 [5,] 1 2 3 4 5 6 > > uneqal_interval3 <- APCI::apci(outcome = "inlfc", + age = "age", + period = "year", + cohort = "ccc", + weight = "wt", + data = test_data,dev.test=FALSE, + print = TRUE, + family = "gaussian", + unequal_interval = T, + age_range = 20:69, + period_range = 1990:2019, + age_group = c("20-29","30-39", + "40-49","50-59", + "60-69"), + period_group = c("1990-1994","1995-1999", + "2000-2004","2005-2009", + "2010-2014","2015-2019")) inlfc ~ age * year Intercept: estimate se p sig 1 0.694 0.018 0.000 *** Age Effect: age_group age_estimate age_se age_p age_sig 1 1 0.033 0.035 0.337 2 2 0.118 0.027 0.000 *** 3 3 0.129 0.029 0.000 *** 4 4 0.024 0.032 0.456 5 5 -0.305 0.051 0.000 *** Period Effect: period_group period_estimate period_se period_p period_sig 1 1 -0.023 0.045 0.616 2 2 0.068 0.045 0.133 3 3 -0.059 0.035 0.088 4 4 0.083 0.033 0.012 * 5 5 -0.046 0.039 0.239 6 6 -0.023 0.042 0.586 Cohort Deviation: cohort_average_group cohort_average cohort_average_se cohort_average_t 1 1 0.025 0.131 0.195 2 2 -0.141 0.093 -1.519 3 3 0.051 0.047 1.076 4 4 0.067 0.040 1.702 5 5 -0.008 0.035 -0.237 6 6 -0.020 0.036 -0.553 7 7 -0.002 0.033 -0.058 8 8 -0.001 0.039 -0.015 9 9 -0.010 0.062 -0.167 10 10 0.007 0.088 0.076 cohort_average_p cohort_average_sig 1 0.846 2 0.129 3 0.282 4 0.089 5 0.812 6 0.580 7 0.954 8 0.988 9 0.867 10 0.939 Cohort Life Course Dynamics: cohort_slope_group cohort_slope cohort_slope_se cohort_slope_t 1 1 NA NA NA 2 2 0.072 0.119 0.606 3 3 -0.118 0.080 -1.470 4 4 0.263 0.069 3.791 5 5 -0.194 0.075 -2.605 6 6 0.026 0.083 0.312 7 7 -0.023 0.062 -0.376 8 8 0.127 0.065 1.964 9 9 -0.008 0.081 -0.102 10 10 NA NA NA cohort_slope_p cohort_slope_sig 1 NA 2 0.544 3 0.142 4 0.000 *** 5 0.009 ** 6 0.755 7 0.707 8 0.050 * 9 0.919 10 NA > uneqal_interval3$cohort_index [,1] [,2] [,3] [,4] [,5] [,6] [1,] 5 6 7 8 9 10 [2,] 4 5 6 7 8 9 [3,] 3 4 5 6 7 8 [4,] 2 3 4 5 6 7 [5,] 1 2 3 4 5 6 > > uneqal_interval2$cohort_index [,1] [,2] [,3] [,4] [,5] [,6] [1,] 5 6 7 8 9 10 [2,] 4 5 6 7 8 9 [3,] 3 4 5 6 7 8 [4,] 2 3 4 5 6 7 [5,] 1 2 3 4 5 6 > uneqal_interval3$cohort_index [,1] [,2] [,3] [,4] [,5] [,6] [1,] 5 6 7 8 9 10 [2,] 4 5 6 7 8 9 [3,] 3 4 5 6 7 8 [4,] 2 3 4 5 6 7 [5,] 1 2 3 4 5 6 > uneqal_interval2$cohort_average$cohort_average [1] "0.0254361267221172" "-0.141203283744971" "0.0509004019324624" [4] "0.0672997400346506" "-0.00821036406897302" "-0.0200626689242982" [7] "-0.00190345668469692" "-0.000591199515578879" "-0.0104368222363582" [10] "0.00669650955643211" > uneqal_interval3$cohort_average$cohort_average [1] "0.0254361267221172" "-0.141203283744971" "0.0509004019324624" [4] "0.0672997400346506" "-0.00821036406897302" "-0.0200626689242982" [7] "-0.00190345668469692" "-0.000591199515578879" "-0.0104368222363582" [10] "0.00669650955643211" > > # simulated panel data for GEE > simulation_gee <- simulation > simulation_gee$id <- 1:nrow(simulation_gee) > simulation_gee$idid <- 1:nrow(simulation_gee) > # simulation_gee$id <- NULL > simulation_gee = simulation_gee[sample(nrow(simulation_gee),30000,replace=T),] > model_gee <- apci(outcome = "y", + age = "age", + period = "period", + cohort = NULL, + weight = NULL, + covariate = NULL, + data=simulation_gee, + family ="gaussian", + dev.test = FALSE, + print = TRUE, + gee = TRUE, + id = "id", + corstr = "exchangeable") y ~ age * period Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27 running glm to get initial regression estimate (Intercept) acc1 acc2 acc3 acc4 4.080210e+01 -1.916530e+01 -1.750831e+01 -1.492641e+01 -1.130373e+01 acc5 acc6 acc7 acc8 acc9 -6.697911e+00 -1.311263e+00 5.178316e+00 1.287159e+01 2.164407e+01 pcc1 pcc2 pcc3 pcc4 pcc5 -7.274753e+00 -5.753144e+00 -3.013175e+00 5.402217e-01 4.973915e+00 acc1:pcc1 acc2:pcc1 acc3:pcc1 acc4:pcc1 acc5:pcc1 2.148976e-01 -1.513126e-01 -4.168205e-02 2.570886e-02 2.577487e-02 acc6:pcc1 acc7:pcc1 acc8:pcc1 acc9:pcc1 acc1:pcc2 -6.431045e-04 -2.861604e-01 1.953001e-01 1.950715e-02 3.384259e-01 acc2:pcc2 acc3:pcc2 acc4:pcc2 acc5:pcc2 acc6:pcc2 -2.060338e-01 -5.440392e-02 -2.674861e-01 1.146730e-02 4.615149e-01 acc7:pcc2 acc8:pcc2 acc9:pcc2 acc1:pcc3 acc2:pcc3 1.591101e-01 -2.867103e-01 2.221066e-01 1.873424e-02 2.840525e-03 acc3:pcc3 acc4:pcc3 acc5:pcc3 acc6:pcc3 acc7:pcc3 -3.253973e-01 1.073625e-01 1.505351e-01 -3.432712e-01 1.883933e-01 acc8:pcc3 acc9:pcc3 acc1:pcc4 acc2:pcc4 acc3:pcc4 -1.820358e-01 1.515986e-01 -3.889510e-01 2.300494e-02 2.403859e-01 acc4:pcc4 acc5:pcc4 acc6:pcc4 acc7:pcc4 acc8:pcc4 2.221887e-01 2.623766e-01 -8.586935e-02 -1.064536e-01 -2.817133e-01 acc9:pcc4 acc1:pcc5 acc2:pcc5 acc3:pcc5 acc4:pcc5 8.964825e-02 -1.929300e-02 2.515620e-01 -6.207392e-02 -5.004908e-02 acc5:pcc5 acc6:pcc5 acc7:pcc5 acc8:pcc5 acc9:pcc5 -5.438742e-01 -3.859267e-01 3.345992e-01 6.995028e-01 -2.813187e-01 Intercept: estimate se p sig 1 40.802 0.006 0.000 Age Effect: age_group age_estimate age_se age_p age_sig 1 1 -19.166 0.018 0.000 *** 2 2 -17.508 0.017 0.000 *** 3 3 -14.926 0.018 0.000 *** 4 4 -11.304 0.017 0.000 *** 5 5 -6.698 0.018 0.000 *** 6 6 -1.311 0.017 0.000 *** 7 7 5.178 0.018 0.000 *** 8 8 12.872 0.018 0.000 *** 9 9 21.644 0.016 0.000 *** 10 10 31.219 0.017 0.000 *** Period Effect: period_group period_estimate period_se period_p period_sig 1 1 -7.275 0.013 0.000 *** 2 2 -5.753 0.013 0.000 *** 3 3 -3.013 0.013 0.000 *** 4 4 0.540 0.013 0.000 *** 5 5 4.974 0.013 0.000 *** 6 6 10.527 0.013 0.000 *** Cohort Deviation: cohort_average_group cohort_average cohort_average_se cohort_average_t 1 1 -0.001 0.036 -0.031 2 2 -0.180 0.027 -6.732 3 3 0.216 0.024 8.944 4 4 -0.099 0.020 -4.916 5 5 0.025 0.018 1.357 6 6 0.030 0.016 1.866 7 7 0.014 0.017 0.855 8 8 -0.009 0.017 -0.544 9 9 -0.085 0.017 -5.001 10 10 -0.048 0.017 -2.736 11 11 0.125 0.019 6.740 12 12 -0.014 0.020 -0.727 13 13 0.035 0.022 1.570 14 14 0.030 0.028 1.068 15 15 -0.164 0.039 -4.236 cohort_average_p cohort_average_sig 1 0.975 2 0.000 *** 3 0.000 *** 4 0.000 *** 5 0.175 6 0.062 7 0.393 8 0.587 9 0.000 *** 10 0.006 ** 11 0.000 *** 12 0.467 13 0.116 14 0.285 15 0.000 *** Cohort Life Course Dynamics: cohort_slope_group cohort_slope cohort_slope_se cohort_slope_t 1 1 NA NA NA 2 2 -0.280 0.037 -7.543 3 3 0.025 0.042 0.596 4 4 0.307 0.039 7.954 5 5 0.014 0.037 0.386 6 6 -0.299 0.037 -8.136 7 7 0.139 0.038 3.705 8 8 0.126 0.038 3.298 9 9 -0.183 0.039 -4.698 10 10 0.028 0.041 0.693 11 11 -0.172 0.040 -4.299 12 12 -0.057 0.037 -1.542 13 13 0.447 0.039 11.506 14 14 0.070 0.039 1.775 15 15 NA NA NA cohort_slope_p cohort_slope_sig 1 NA 2 0.000 *** 3 0.551 4 0.000 *** 5 0.699 6 0.000 *** 7 0.000 *** 8 0.001 *** 9 0.000 *** 10 0.488 11 0.000 *** 12 0.123 13 0.000 *** 14 0.076 15 NA > summary(model_gee) Length Class Mode model 23 gee list dev_global 0 -none- NULL intercept 4 -none- character age_effect 50 -none- character period_effect 30 -none- character cohort_average 6 data.frame list cohort_slope 6 data.frame list int_matrix 5 data.frame list cohort_index 60 -none- numeric data 5 data.frame list > > proc.time() user system elapsed 13.28 2.28 15.54