summary, tables, and correlations for data frames
dcor(data, y = NULL, x = NULL, use = "pairwise.complete.obs", ...)
if x is formula or names for data frame then data frame is needed.
name of variable, or fomula, or names of variables on data frame.
possible group variable
how to handle missing values
Optional additional arguments
data("sTRACE",package="timereg")
dt<- sTRACE
dt$time2 <- dt$time^2
dt$wmi2 <- dt$wmi^2
head(dt)
#> no wmi status chf age sex diabetes time vf time2 wmi2
#> X1944 1944 1.5 9 0 84.924 1 1 1.345000 0 1.809025 2.25
#> X5783 5783 1.9 0 1 74.193 0 0 6.910000 0 47.748100 3.61
#> X784 784 0.8 9 0 78.081 0 1 0.196000 0 0.038416 0.64
#> X3763 3763 1.3 0 0 55.479 1 0 7.543000 0 56.896849 1.69
#> X2927 2927 1.6 0 1 62.997 0 0 7.126000 0 50.779876 2.56
#> X4511 4511 1.0 9 1 67.644 1 0 4.532606 0 20.544520 1.00
dcor(dt)
#> no wmi status chf age
#> no 1.0000000000 -0.009437654 0.0002042854 0.03176893 -0.08317491
#> wmi -0.0094376537 1.000000000 -0.3103788196 -0.37464791 -0.19288208
#> status 0.0002042854 -0.310378820 1.0000000000 0.34237066 0.43051203
#> chf 0.0317689348 -0.374647914 0.3423706564 1.00000000 0.34197944
#> age -0.0831749071 -0.192882080 0.4305120263 0.34197944 1.00000000
#> sex -0.1090494653 -0.023542809 -0.0671941443 -0.13205952 -0.27356308
#> diabetes 0.0103460848 -0.138602457 0.0866091232 0.08871325 0.04685823
#> time 0.0185007942 0.328582293 -0.8145783614 -0.34820213 -0.41435287
#> vf 0.0618025722 -0.089668054 0.0473290244 0.13467109 -0.03983927
#> time2 0.0091527320 0.313368613 -0.8526160479 -0.34533562 -0.41370693
#> wmi2 -0.0081611472 0.987512109 -0.2992334471 -0.36641743 -0.18629143
#> sex diabetes time vf time2
#> no -0.10904947 0.01034608 0.01850079 0.06180257 0.009152732
#> wmi -0.02354281 -0.13860246 0.32858229 -0.08966805 0.313368613
#> status -0.06719414 0.08660912 -0.81457836 0.04732902 -0.852616048
#> chf -0.13205952 0.08871325 -0.34820213 0.13467109 -0.345335622
#> age -0.27356308 0.04685823 -0.41435287 -0.03983927 -0.413706928
#> sex 1.00000000 -0.05523671 0.03630103 -0.04760863 0.037530286
#> diabetes -0.05523671 1.00000000 -0.09049143 -0.05060615 -0.087337711
#> time 0.03630103 -0.09049143 1.00000000 -0.10704592 0.976099537
#> vf -0.04760863 -0.05060615 -0.10704592 1.00000000 -0.076612883
#> time2 0.03753029 -0.08733771 0.97609954 -0.07661288 1.000000000
#> wmi2 -0.01543475 -0.12474865 0.31427694 -0.09003700 0.302021849
#> wmi2
#> no -0.008161147
#> wmi 0.987512109
#> status -0.299233447
#> chf -0.366417431
#> age -0.186291429
#> sex -0.015434752
#> diabetes -0.124748650
#> time 0.314276938
#> vf -0.090037003
#> time2 0.302021849
#> wmi2 1.000000000
dcor(dt,~time+wmi)
#> time wmi
#> time 1.0000000 0.3285823
#> wmi 0.3285823 1.0000000
dcor(dt,~time+wmi,~vf+chf)
#> vf: 0
#> chf: 0
#> time wmi
#> time 1.0000000 0.2443018
#> wmi 0.2443018 1.0000000
#> ------------------------------------------------------------
#> vf: 1
#> chf: 0
#> time wmi
#> time 1.0000000 0.8466897
#> wmi 0.8466897 1.0000000
#> ------------------------------------------------------------
#> vf: 0
#> chf: 1
#> time wmi
#> time 1.0000000 0.1903859
#> wmi 0.1903859 1.0000000
#> ------------------------------------------------------------
#> vf: 1
#> chf: 1
#> time wmi
#> time 1.000000 0.354452
#> wmi 0.354452 1.000000
dcor(dt,time+wmi~vf+chf)
#> vf: 0
#> chf: 0
#> time wmi
#> time 1.0000000 0.2443018
#> wmi 0.2443018 1.0000000
#> ------------------------------------------------------------
#> vf: 1
#> chf: 0
#> time wmi
#> time 1.0000000 0.8466897
#> wmi 0.8466897 1.0000000
#> ------------------------------------------------------------
#> vf: 0
#> chf: 1
#> time wmi
#> time 1.0000000 0.1903859
#> wmi 0.1903859 1.0000000
#> ------------------------------------------------------------
#> vf: 1
#> chf: 1
#> time wmi
#> time 1.000000 0.354452
#> wmi 0.354452 1.000000
dcor(dt,c("time*","wmi*"),~vf+chf)
#> vf: 0
#> chf: 0
#> time time2 wmi wmi2
#> time 1.0000000 0.9744619 0.2443018 0.2286891
#> time2 0.9744619 1.0000000 0.2345873 0.2233235
#> wmi 0.2443018 0.2345873 1.0000000 0.9913077
#> wmi2 0.2286891 0.2233235 0.9913077 1.0000000
#> ------------------------------------------------------------
#> vf: 1
#> chf: 0
#> time time2 wmi wmi2
#> time 1.0000000 0.9942844 0.8466897 0.8244614
#> time2 0.9942844 1.0000000 0.8793376 0.8612097
#> wmi 0.8466897 0.8793376 1.0000000 0.9968521
#> wmi2 0.8244614 0.8612097 0.9968521 1.0000000
#> ------------------------------------------------------------
#> vf: 0
#> chf: 1
#> time time2 wmi wmi2
#> time 1.0000000 0.9731838 0.1903859 0.1826388
#> time2 0.9731838 1.0000000 0.1762251 0.1697576
#> wmi 0.1903859 0.1762251 1.0000000 0.9833844
#> wmi2 0.1826388 0.1697576 0.9833844 1.0000000
#> ------------------------------------------------------------
#> vf: 1
#> chf: 1
#> time time2 wmi wmi2
#> time 1.0000000 0.9828671 0.3544520 0.3026710
#> time2 0.9828671 1.0000000 0.2827122 0.2298121
#> wmi 0.3544520 0.2827122 1.0000000 0.9842457
#> wmi2 0.3026710 0.2298121 0.9842457 1.0000000