MATCHING 3 GROUPS BY MATCHIT

50 Views Asked by At

I am just wondering if someone can help me. I want to compare scores (The columns indicated by KOOS) and Survivorship of a procedure between 3 groups from a big dataset.

I am using R markdown and I have a big dataset of 650 observations and multiple columns over 3 sheets.

The following is a sample of the data in each sheet BY dput : TEST1 , TEST2, and TEST 3

TEST1 Show in New Window

structure(list(NAME = c("A", "B", "C", "D", "E", "F", "G", "H", 
"I"), SEX = c("F", "F", "M", "M", "M", "M", "F", "M", "F"), AGE = c(53, 
49, 37, 24, 38, 54, 53, 23, 37), KL = c(3, 4, 2, 2, 1, 2, 1, 
2, 4), BMI = c(22.2, 31, 35, 26.1, 36.9, 26.4, 28, 27, 40), KOOS_SYMP_2Y = c(67.8571428571429, 
57, 46.4285714285714, 39, 46, 14.2857142857143, 64.2857142857143, 
78.5714285714286, 32), KOOS_PAIN_2Y = c(52.7777777777778, 50, 
80.5555555555556, 67, 56, 30.5555555555556, 94.4444444444444, 
80.5555555555556, 36), KOOS_ADL_2Y = c(97.0588235294118, 53, 
79.4117647058823, NA, 56, 33.8235294117647, 98.5294117647059, 
97.0588235294118, 38), KOOS_SPORT_2Y = c(35, 5, 50, 50, 0, 16.6666666666667, 
80, 95, 30), KOOS_QOL_2Y = c(50, 6, 50, 38, 25, 6.25, 87.5, 62.5, 
19), KOOS_WOMAC_2Y = c(12, 44, 19, 56, 42, 63, 4, 6, 23), KOOS_TOTAL_2Y = c(70.8333333333333, 
42.9, 67.8571428571429, 57.14, 44.6, 25.625, 88.6904761904762, 
86.9047619047619, 33.9), OKS_2Y = c(39, 30, 38, 31, 23, 13, 42, 
46, 25), OKS_APQ_2Y = c(20, 1, 16, 7, 0, 5, 16, 29, 9)), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -9L))

TEST2

structure(list(NAME = c("A", "B", "C", "D", "E", "F", "G", "H", 
"I"), PREOP_T = c(-8, -3, -6.9, -4, -1.2, -4, -3.8, -7, -4.6), 
    POSTOP_T = c(0, 5, -1, -1.9, -0.7, 4, 2.9, -3, 1)), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -9L))

TEST3

structure(list(NAME = c("A", "B", "C", "D", "E", "F", "G", "H", 
"I"), DOB = structure(c(-539481600, -138412800, 77155200, 569203200, 
19958400, -214531200, -415497600, -300758400, 236736000), class = c("POSIXct", 
"POSIXt"), tzone = "UTC"), D_SURGERY = structure(c(1154995200, 
1418428800, 1266624000, 1344384000, 1232582400, 1504915200, 1289260800, 
1229126400, 1423008000), class = c("POSIXct", "POSIXt"), tzone = "UTC"), 
    REV_DATE = structure(c(NA, NA, NA, NA, NA, NA, 1347408000, 
    NA, NA), class = c("POSIXct", "POSIXt"), tzone = "UTC"), 
    COMPLICATION = c("TEXT", "TEXT", "TEXT", "TEXT", "TEXT", 
    "TEXT", "TEXT", "TEXT", "TEXT")), class = c("tbl_df", "tbl", 
"data.frame"), row.names = c(NA, -9L))

I want to create 3 groups from these 650 observations based on the BMI Group I (< 25), Group II ( 25:30) and Group III (> 30)

But I want these three groups to be matched in AGE, SEX, KL From the first sheet TEST 1, and to be matched in the PREOP_T and POSTOP_T from the second sheet TEST 2.

I am aware of the Matchit but do not know how to use it to create 3 groups matched in all these variables.

Also I can do Kaplan Meir analysis for one group using survfit from “survival” library. But do not know how to do it for 3 groups with a different colour line for each group

0

There are 0 best solutions below