Hypertension Cognition Study

Author

Samuel Blay Nguah

Published

May 7, 2024

Please Note
  1. Income less that 90GHC were only 3 so they were added to the “<100GHC”
  2. All patients are hypertensive so disease class has been changed to DM
  3. Duration of exercising is in minutes
  4. MOCA is the dependent variable so cannot be the independent as well
  5. We may need to do data imputing for the missing observations

Creating functions for regression

Code
chsqft <- function(data, variable, by, ...){
    data <- data[c(variable, by)] %>% dplyr::filter(complete.cases(.))
    mat1 <- table(data[[variable]], data[[by]]) %>% 
        rstatix::prop_trend_test() %>% 
        rename(p.value=p, estimate=statistic)
}

clmft <- function(data, variable, by, ...){
    data <- data[c(variable, by)] %>% dplyr::filter(complete.cases(.))
    x <- ordinal::clm(data[[by]] ~ data[[variable]]) %>% 
        broom::tidy() %>% 
        filter(coef.type == "location") %>% 
        rename(method = term) %>%
        mutate(method = "Ordinal Cumulative Link Model")
}

Data cleaning

Code
library(tidyverse)
df_hptcog <- 
    readxl::read_xlsx("Diminish Structure MASTER FILE.xlsx") %>% 
    janitor::clean_names() %>% 
    rename(
        sex = a1_gender,
        ageyrs = a3_how_old_are_you,
        resid = a6_please_indicate_the_location_of_your_residence,
        educ = a8_what_is_the_highest_level_of_education_you_have_completed,
        income = n2_on_average_what_is_the_monthly_income_for_the_entire_household_choose_one,
        currently_smoke = b1_do_you_currently_smoke_any_tobacco_products_such_as_cigarettes_cigars_or_pipes_choose_one_if_no_go_to_b3,
        past_smoked = b3_have_you_smoked_in_the_past_choose_one,
        nhis = a4_do_you_have_a_valid_national_health_insurance_scheme_card,
        dm = x4_diabetes_mellitus,
        alcohol = c1_do_you_currently_use_alcoholic_beverage_such_as_beer_wine_spirits_palm_wine_or_akpeteshie_choose_one,
        salt_add = d5_in_a_typical_week_how_often_is_salt_added_to_food_that_has_already_been_prepared_please_circle_the_correct_response,
        physical_activity = e1_do_you_frequently_perform_physical_activities_that_cause_a_small_increase_in_breathing_or_make_your_heart_rate_go_up_such_as_fast_brisk_walking_jogging_bicycling_or_other_please_circle_the_correct_response,
        dura_exercise = e2_how_much_time_in_minutes_do_you_spend_walking_fast_briskly_jogging_bicycling_or_any_other_form_of_exercise_on_a_typical_day,
        fruits_per_week = d1_in_a_typical_week_on_how_many_days_in_the_past_week_have_you_had_fruits_if_zero_go_to_next_question_d4,
        daily_fruits = d2_how_many_servings_of_fruit_do_you_eat_on_one_of_those_days ,
        days_veges = d3_in_a_typical_week_on_how_many_days_in_the_past_week_have_you_had_vegetables,
        daily_veges = d4_how_many_servings_of_vegetables_do_you_eat_on_one_of_those_days,
        heart_failure = x2b_heart_failure_swelling_in_your_both_legs_shortness_of_breath_and_shortness_of_breath_when_lying_down,
        stroke = x3_stroke_weakness_on_one_side_of_the_body,
        dura_hpt = f1_how_many_months_years_ago_were_you_first_told_you_had_high_blood_pressure_months_years,
        med_1 = x1_medication,
        med_2 = x2_medication,
        med_3 = x3_medication,
        med_4 = x4_medication,
        med_5 = x5_medication,
        med_6 = x6_medication,
        med_7 = x7_medication,
        med_8 = x1_other_medication,
        med_9 = x2_other_medication,
        med_10 = x3_other_medication,
        sbp1 = x1_systolic_blood_pressure_mm_hg, 
        sbp2 = x2_systolic_blood_pressure_mm_hg,
        sbp3 = x3_systolic_blood_pressure_mm_hg, 
        sbp4 = x4_systolic_blood_pressure_mm_hg,
        sbp5 = x5_systolic_blood_pressure_mm_hg, 
        sbp6 = x6_systolic_blood_pressure_mm_hg,
        sbp7 = x7_systolic_blood_pressure_mm_hg, 
        sbp8 = x8_systolic_blood_pressure_mm_hg,
        sbp9 = x9_systolic_blood_pressure_mm_hg, 
        sbp10 = x10_systolic,
        dbp1 = x1_diastolic_blood_pressure_mm_hg, 
        dbp2 = x2_diastolic_blood_pressure_mm_hg,
        dbp3 = x3_diastolic_blood_pressure_mm_hg, 
        dbp4 = x4_diastolic_blood_pressure_mm_hg,
        dbp5 = x5_diastolic_blood_pressure_mm_hg, 
        dbp6 = x6_diastolic_blood_pressure_mm_hg,
        dbp7 = x7_diastolic, 
        dbp8 = x8_diastolic_blood_pressure_mm_hg,
        dbp9 = x9_diastolic_blood_pressure_mm_hg, 
        dbp10 = x10_diastolic
    ) %>% 
    mutate(
        moca_tertile = gtools::quantcut(
            moca_score, 
            q = 3, 
            labels = c("Lower Tercile", "Middle Tercile", "Upper Tercile")) %>% 
                factor(levels = c("Upper Tercile", "Middle Tercile", "Lower Tercile")
            ),
        sex = factor(sex, levels = c("Male", "Female")),
        resid = factor(resid, levels = c("Rural","Peri urban", "Urban")),
        educ2 = fct_recode(
            educ,
            None = "Less than primary school",
            None = "No formal schooling",
            None = "Non-formal education",
            Primary = "Primary school completed",
            Secondary = "Secondary school completed",
            Secondary = "High school completed",
            Tertiary = "Post graduate degree",
            Tertiary = "College /University completed") %>% 
            factor(
                levels = c("None", "Primary", "Secondary", "Tertiary"),
                ordered = FALSE),
        income2 = case_when(
            income == "90-100GHc" ~ "<100 GHc", 
            income == "<90 GHc"   ~ "<100 GHc",
            income == "100-500GHc" ~ "100-500GHc",
            income == "500-1000 GHc" ~ "500-1000 GHc",
            income == ">1000 GHc" ~ ">1000 GHc",
            TRUE ~ "Unknown"
            ) %>%
            factor(
                levels = c("<100 GHc", "100-500GHc","500-1000 GHc", 
                           ">1000 GHc", "Unknown")
                ),
        dm2 = case_when(dm == "Yes" ~ "Yes", dm == "No" ~ "No"),
        ever_smoked = case_when(
            currently_smoke == "Yes" | past_smoked == "Yes" ~ "Yes",
            TRUE ~ "No"),
        salt_add2 = case_when(
            salt_add %in% c("Occasionally","Option 2", "Rarely", "Ver often") ~ "Yes",
            salt_add %in% "Never" ~ "No"
            ),
        heart_failure = ifelse(heart_failure=="REFUSED", NA, heart_failure),
        stroke = ifelse(stroke=="REFUSED", NA, heart_failure),
        body_weight = ifelse(body_weight < 20, body_weight + 60, body_weight),
        bmi = body_weight/(height/100)^2,
        across(med_1:med_10, ~toupper(.)),
        nifedipine = case_when(
            str_detect(med_1, "NIFE") | str_detect(med_2, "NIFE") |
            str_detect(med_3, "NIFE") | str_detect(med_4, "NIFE") | 
            str_detect(med_5, "NIFE") | str_detect(med_6, "NIFE") |
            str_detect(med_7, "NIFE") | str_detect(med_8, "NIFE") | 
            str_detect(med_9, "NIFE") | str_detect(med_10, "NIFE") ~ "Yes",
            TRUE ~ "No"
            ),
        amlodipine = case_when(
            str_detect(med_1, "AMLO") | str_detect(med_2, "AMLO") |
            str_detect(med_3, "AMLO") | str_detect(med_4, "AMLO") | 
            str_detect(med_5, "AMLO") | str_detect(med_6, "AMLO") |
            str_detect(med_7, "AMLO") | str_detect(med_8, "AMLO") | 
            str_detect(med_9, "AMLO") | str_detect(med_10, "AMLO") ~ "Yes",
            TRUE ~ "No"
            ),
        losartan = case_when(
            str_detect(med_1, "LOSA") | str_detect(med_2, "LOSA") |
            str_detect(med_3, "LOSA") | str_detect(med_4, "LOSA") | 
            str_detect(med_5, "LOSA") | str_detect(med_6, "LOSA") |
            str_detect(med_7, "LOSA") | str_detect(med_8, "LOSA") | 
            str_detect(med_9, "LOSA") | str_detect(med_10, "LOSA") ~ "Yes",
            TRUE ~ "No"
            ),
        lisinopril = case_when(
            str_detect(med_1, "LISI") | str_detect(med_2, "LISI") |
            str_detect(med_3, "LISI") | str_detect(med_4, "LISI") | 
            str_detect(med_5, "LISI") | str_detect(med_6, "LISI") |
            str_detect(med_7, "LISI") | str_detect(med_8, "LISI") | 
            str_detect(med_9, "LISI") | str_detect(med_10, "LISI") ~ "Yes",
            TRUE ~ "No"
            ),
        bendro = case_when(
            str_detect(med_1, "BENDR") | str_detect(med_2, "BENDR") |
            str_detect(med_3, "BENDR") | str_detect(med_4, "BENDR") | 
            str_detect(med_5, "BENDR") | str_detect(med_6, "BENDR") |
            str_detect(med_7, "BENDR") | str_detect(med_8, "BENDR") | 
            str_detect(med_9, "BENDR") | str_detect(med_10, "BENDR") ~ "Yes",
            TRUE ~ "No"
            ),
        methyldopa = case_when(
            str_detect(med_1, "DOPA") | str_detect(med_2, "DOPA") |
            str_detect(med_3, "DOPA") | str_detect(med_4, "DOPA") | 
            str_detect(med_5, "DOPA") | str_detect(med_6, "DOPA") |
            str_detect(med_7, "DOPA") | str_detect(med_8, "DOPA") | 
            str_detect(med_9, "DOPA") | str_detect(med_10, "DOPA")~ "Yes",
            TRUE ~ "No"
            ),
        hydralazine = case_when(
            str_detect(med_1, "HYDRALA") | str_detect(med_2, "HYDRALA") |
            str_detect(med_3, "HYDRALA") | str_detect(med_4, "HYDRALA") | 
            str_detect(med_5, "HYDRALA") | str_detect(med_6, "HYDRALA") |
            str_detect(med_7, "HYDRALA") | str_detect(med_8, "HYDRALA") | 
            str_detect(med_9, "HYDRALA") | str_detect(med_10, "HYDRALA")~ "Yes",
            TRUE ~ "No"
            ),
        metformin = case_when(
            str_detect(med_1, "METFO") | str_detect(med_2, "METFO") |
            str_detect(med_3, "METFO") | str_detect(med_4, "METFO") | 
            str_detect(med_5, "METFO") | str_detect(med_6, "METFO") |
            str_detect(med_7, "METFO") | str_detect(med_8, "METFO") | 
            str_detect(med_9, "METFO") | str_detect(med_10, "METFO")~ "Yes",
            TRUE ~ "No"
            ),
        aspirin = case_when(
            str_detect(med_1, "ASPIR") | str_detect(med_2, "ASPIR") |
            str_detect(med_3, "ASPIR") | str_detect(med_4, "ASPIR") | 
            str_detect(med_5, "ASPIR") | str_detect(med_6, "ASPIR") |
            str_detect(med_7, "ASPIR") | str_detect(med_8, "ASPIR") | 
            str_detect(med_9, "ASPIR") | str_detect(med_10, "ASPIR")~ "Yes",
            TRUE ~ "No"
            ),
        gliclazide = case_when(
            str_detect(med_1, "GLICL") | str_detect(med_2, "GLICL") |
            str_detect(med_3, "GLICL") | str_detect(med_4, "GLICL") | 
            str_detect(med_5, "GLICL") | str_detect(med_6, "GLICL") |
            str_detect(med_7, "GLICL") | str_detect(med_8, "GLICL") | 
            str_detect(med_9, "GLICL") | str_detect(med_10, "GLICL")~ "Yes",
            TRUE ~ "No"
            ),
        atorvastatin = case_when(
            str_detect(med_1, "ATORV") | str_detect(med_2, "ATORV") |
            str_detect(med_3, "ATORV") | str_detect(med_4, "ATORV") | 
            str_detect(med_5, "ATORV") | str_detect(med_6, "ATORV") |
            str_detect(med_7, "ATORV") | str_detect(med_8, "ATORV") | 
            str_detect(med_9, "ATORV") | str_detect(med_10, "ATORV")~ "Yes",
            TRUE ~ "No"
            ),
        pioglitazone = case_when(
            str_detect(med_1, "PIOG") | str_detect(med_2, "PIOG") |
            str_detect(med_3, "PIOG") | str_detect(med_4, "PIOG") | 
            str_detect(med_5, "PIOG") | str_detect(med_6, "PIOG") |
            str_detect(med_7, "PIOG") | str_detect(med_8, "PIOG") | 
            str_detect(med_9, "PIOG") | str_detect(med_10, "PIOG")~ "Yes",
            TRUE ~ "No"
            ),
        atenolol = case_when(
            str_detect(med_1, "ATENOLOL") | str_detect(med_2, "ATENOLOL") |
            str_detect(med_3, "ATENOLOL") | str_detect(med_4, "ATENOLOL") | 
            str_detect(med_5, "ATENOLOL") | str_detect(med_6, "ATENOLOL") |
            str_detect(med_7, "ATENOLOL") | str_detect(med_8, "ATENOLOL") | 
            str_detect(med_9, "ATENOLOL") | str_detect(med_10, "ATENOLOL")~ "Yes",
            TRUE ~ "No"
            ),
        bisoprolol = case_when(
            str_detect(med_1, "BISOPROLOL") | str_detect(med_2, "BISOPROLOL") |
            str_detect(med_3, "BISOPROLOL") | str_detect(med_4, "BISOPROLOL") | 
            str_detect(med_5, "BISOPROLOL") | str_detect(med_6, "BISOPROLOL") |
            str_detect(med_7, "BISOPROLOL") | str_detect(med_8, "BISOPROLOL") | 
            str_detect(med_9, "BISOPROLOL") | str_detect(med_10, "BISOPROLOL")~ "Yes",
            TRUE ~ "No"
            ),
        glimepiride = case_when(
            str_detect(med_1, "GLIM") | str_detect(med_2, "GLIM") |
            str_detect(med_3, "GLIM") | str_detect(med_4, "GLIM") | 
            str_detect(med_5, "GLIM") | str_detect(med_6, "GLIM") |
            str_detect(med_7, "GLIM") | str_detect(med_8, "GLIM") | 
            str_detect(med_9, "GLIM") | str_detect(med_10, "GLIM")~ "Yes",
            TRUE ~ "No"
            ),
        furosemide = case_when(
            str_detect(med_1, "FUROS") | str_detect(med_2, "FUROS") |
            str_detect(med_3, "FUROS") | str_detect(med_4, "FUROS") | 
            str_detect(med_5, "FUROS") | str_detect(med_6, "FUROS") |
            str_detect(med_7, "FUROS") | str_detect(med_8, "FUROS") | 
            str_detect(med_9, "FUROS") | str_detect(med_10, "FUROS")~ "Yes",
            TRUE ~ "No"
            ),
        glibenclamide = case_when(
            str_detect(med_1, "GLIB") | str_detect(med_2, "GLIB") |
            str_detect(med_3, "GLIB") | str_detect(med_4, "GLIB") | 
            str_detect(med_5, "GLIB") | str_detect(med_6, "GLIB") |
            str_detect(med_7, "GLIB") | str_detect(med_8, "GLIB") | 
            str_detect(med_9, "GLIB") | str_detect(med_10, "GLIB")~ "Yes",
            TRUE ~ "No"
            ),
        labetalol = case_when(
            str_detect(med_1, "LABET") | str_detect(med_2, "LABET") |
            str_detect(med_3, "LABET") | str_detect(med_4, "LABET") | 
            str_detect(med_5, "LABET") | str_detect(med_6, "LABET") |
            str_detect(med_7, "LABET") | str_detect(med_8, "LABET") | 
            str_detect(med_9, "LABET") | str_detect(med_10, "LABET")~ "Yes",
            TRUE ~ "No"
            ),
        mixtard = case_when(
            str_detect(med_1, "MIXTARD") | str_detect(med_2, "MIXTARD") |
            str_detect(med_3, "MIXTARD") | str_detect(med_4, "MIXTARD") | 
            str_detect(med_5, "MIXTARD") | str_detect(med_6, "MIXTARD") |
            str_detect(med_7, "MIXTARD") | str_detect(med_8, "MIXTARD") | 
            str_detect(med_9, "MIXTARD") | str_detect(med_10, "MIXTARD")~ "Yes",
            TRUE ~ "No"
            ),
        spironolactone = case_when(
            str_detect(med_1, "SPIRONO") | str_detect(med_2, "SPIRONO") |
            str_detect(med_3, "SPIRONO") | str_detect(med_4, "SPIRONO") | 
            str_detect(med_5, "SPIRONO") | str_detect(med_6, "SPIRONO") |
            str_detect(med_7, "SPIRONO") | str_detect(med_8, "SPIRONO") | 
            str_detect(med_9, "SPIRONO") | str_detect(med_10, "SPIRONO")~ "Yes",
            TRUE ~ "No"
            ),
        acei = factor(lisinopril, levels = c("No", "Yes")),
        arb = factor(losartan, levels = c("No", "Yes")),
        bb = case_when(
            atenolol == "Yes" ~ "Yes",
            bisoprolol == "Yes" ~ "Yes",
            labetalol == "Yes" ~ "Yes",
            TRUE ~ "No") %>% 
            factor(),
        ccb = case_when(
            amlodipine == "Yes" ~ "Yes",
            nifedipine == "Yes" ~ "Yes",
            TRUE ~ "No") %>% 
            factor(),
        diuretics = case_when(
            spironolactone == "Yes" ~ "Yes",
            furosemide == "Yes" ~ "Yes",
            bendro == "Yes" ~ "Yes",
            TRUE ~ "No") %>% 
            factor(),
        antidiabetics = (gliclazide=="Yes") + (glimepiride == "Yes") + 
            (glibenclamide == "Yes") + (metformin == "Yes") + 
            (mixtard == "Yes"),
        sulphonylurea = case_when(
            gliclazide == "Yes" ~ "Yes",
            glimepiride == "Yes" ~ "Yes",
            glibenclamide == "Yes" ~ "Yes",
            TRUE ~ "No") %>% 
            factor(),
         antihypertensives = (nifedipine == "Yes") + (hydralazine == "Yes") + 
            (amlodipine == "Yes") + (losartan == "Yes") + 
            (lisinopril == "Yes") + (bendro == "Yes") + 
            (methyldopa == "Yes") + (atenolol == "Yes") + 
            (bisoprolol == "Yes") + (furosemide == "Yes") + 
            (labetalol == "Yes") + (spironolactone == "Yes"),
        across(c(sbp1,dbp4, dbp7, dbp8, dbp9), ~as.numeric(.)), 
        low_moca = case_when(
            moca_tertile == "Lower Tercile" ~ "Yes",
            TRUE ~ "No"
            ) %>% 
            factor()
            ) %>% 
    rowwise() %>% 
    mutate(
        sbp_sd = sd(
            c(sbp1, sbp2, sbp3, sbp4, sbp5, sbp6, sbp7, sbp8, sbp9, sbp10), 
            na.rm=T),
        dbp_sd = sd(
            c(dbp1, dbp2, dbp3, dbp4, dbp5, dbp6, dbp7, dbp8, dbp9, dbp10), 
            na.rm=T),
        sbp_mean = mean(
            c(sbp1, sbp2, sbp3, sbp4, sbp5, sbp6, sbp7, sbp8, sbp9, sbp10), 
            na.rm=T),
        dbp_mean = mean(
            c(dbp1, dbp2, dbp3, dbp4, dbp5, dbp6, dbp7, dbp8, dbp9, dbp10), 
            na.rm=T)
        ) %>% 
    ungroup() %>% 
    mutate(
        controlled_bp = case_when(
            (sbp_mean < 140) & (dbp_mean < 90) ~ "Controlled",
            (sbp_mean >= 140) | (dbp_mean >= 90) ~ "Uncontrolled") %>% 
                factor(levels = c("Controlled","Uncontrolled"))
        ) %>% 
    select(
        ageyrs, sex, resid, educ, educ2, income, income2, dm2, currently_smoke, 
        ever_smoked, past_smoked, alcohol,nhis, moca_score, salt_add2, 
        physical_activity, dura_exercise, fruits_per_week, salt_add, daily_fruits, 
        days_veges, daily_veges, heart_failure, stroke, bmi, waist_circumference, 
        dura_hpt, nifedipine:spironolactone, moca_tertile, starts_with("med_"), 
        acei, arb, bb, ccb, diuretics, methyldopa, hydralazine, antidiabetics,
        metformin, sulphonylurea, pioglitazone, mixtard, atorvastatin, aspirin,
        antihypertensives, hill_and_bone_score, starts_with("sbp"), 
        starts_with("dbp"), body_weight, height, low_moca, sbp_mean, dbp_mean,
        controlled_bp
        )

labelled::var_label(df_hptcog) <- 
    list(
        sex = "Sex",
        ageyrs = "Age in years",
        resid = "Residence",
        educ = "Educational level",
        educ2 = "Educational level",
        income = "Income",
        income2 = "Income",
        currently_smoke = "Currently smoke",
        past_smoked = "Ever Smoked",
        nhis = "Have valid NHIS",
        moca_score = "MOCA Score",
        dm2 = "Diabetes Mellitus",
        ever_smoked = "Ever smoked",
        alcohol = "Alcohol intake",
        salt_add = "Salt added to food",
        salt_add2 = "Salt added to food",
        physical_activity = "Physical activity",
        dura_exercise = "Daily minutes exercising",
        fruits_per_week = "Days of Fruit per week",
        daily_fruits = "Daily Fruit servings",
        days_veges = "Days/week vegetables",
        daily_veges = "Daily vegetable servings",
        heart_failure = "Heart failure",
        stroke = "Stroke",
        bmi = "BMI",
        waist_circumference = "Waist Circunference",
        dura_hpt = "Duration of hypertension in years",
        med_1 = "Medications 1",
        med_2 = "Medications 2",
        med_3 = "Medications 3",
        med_4 = "Medications 4",
        med_5 = "Medications 5",
        med_6 = "Medications 6",
        med_7 = "Medications 7",
        med_8 = "Medications 8",
        med_9 = "Medications 9",
        med_10 = "Medications 10",
        acei = "ACE-Inhibitors",
        arb = "ARB use",
        bb = "Beta-Blockers use", 
        ccb = "Calcium Channel Blockers", 
        diuretics = "Diuretics",
        methyldopa = "Methyldopa",
        hydralazine = "Hydralazine",
        antidiabetics = "No. of antidiabetics",
        metformin = "Metformin",
        sulphonylurea = "Sulphonylurea",
        pioglitazone = "Thiazolidinedione",
        mixtard = "Insulin",
        atorvastatin = "Statin",
        aspirin = "Antiplatelet",
        antihypertensives = "No. of Antihypertensive",
        hill_and_bone_score = "Hillbone score",
        sbp_sd = "Systolic variability",
        dbp_sd = "Diastolic variability",
        sbp_mean = "Systolic Blood Pressure",
        dbp_mean = "Diastolic Blood Pressure",
        controlled_bp = "Controlled Blood Pressure"
        )

Summary of Data

Code
df_hptcog %>% 
    select(-starts_with("med_")) %>% 
    summarytools::dfSummary(graph.col = F, labels.col = F)
Data Frame Summary  
df_hptcog  
Dimensions: 214 x 85  
Duplicates: 0  

----------------------------------------------------------------------------------------------------
No   Variable              Stats / Values                 Freqs (% of Valid)    Valid      Missing  
---- --------------------- ------------------------------ --------------------- ---------- ---------
1    ageyrs                Mean (sd) : 64 (13.4)          57 distinct values    214        0        
     [numeric]             min < med < max:                                     (100.0%)   (0.0%)   
                           27 < 64 < 105                                                            
                           IQR (CV) : 18.8 (0.2)                                                    

2    sex                   1. Male                         45 (21.0%)           214        0        
     [factor]              2. Female                      169 (79.0%)           (100.0%)   (0.0%)   

3    resid                 1. Rural                        25 (11.7%)           213        1        
     [factor]              2. Peri urban                   18 ( 8.5%)           (99.5%)    (0.5%)   
                           3. Urban                       170 (79.8%)                               

4    educ                  1. College /University compl    9 ( 4.2%)            214        0        
     [character]           2. High school completed       27 (12.6%)            (100.0%)   (0.0%)   
                           3. Less than primary school    16 ( 7.5%)                                
                           4. No formal schooling         78 (36.4%)                                
                           5. Non-formal education         5 ( 2.3%)                                
                           6. Post graduate degree         1 ( 0.5%)                                
                           7. Primary school completed    24 (11.2%)                                
                           8. Refused                      2 ( 0.9%)                                
                           9. Secondary school complete   52 (24.3%)                                

5    educ2                 1. None                        99 (46.7%)            212        2        
     [factor]              2. Primary                     24 (11.3%)            (99.1%)    (0.9%)   
                           3. Secondary                   79 (37.3%)                                
                           4. Tertiary                    10 ( 4.7%)                                

6    income                1. <90 GHc                      3 ( 1.4%)            214        0        
     [character]           2. >1000 GHc                   21 ( 9.8%)            (100.0%)   (0.0%)   
                           3. 100-500GHc                  64 (29.9%)                                
                           4. 500-1000 GHc                69 (32.2%)                                
                           5. 90-100GHc                    9 ( 4.2%)                                
                           6. DON'T KNOW                  36 (16.8%)                                
                           7. REFUSED                     12 ( 5.6%)                                

7    income2               1. <100 GHc                    12 ( 5.6%)            214        0        
     [factor]              2. 100-500GHc                  64 (29.9%)            (100.0%)   (0.0%)   
                           3. 500-1000 GHc                69 (32.2%)                                
                           4. >1000 GHc                   21 ( 9.8%)                                
                           5. Unknown                     48 (22.4%)                                

8    dm2                   1. No                          112 (53.1%)           211        3        
     [character]           2. Yes                          99 (46.9%)           (98.6%)    (1.4%)   

9    currently_smoke       1. No                          212 (99.1%)           214        0        
     [character]           2. Yes                           2 ( 0.9%)           (100.0%)   (0.0%)   

10   ever_smoked           1. No                          195 (91.1%)           214        0        
     [character]           2. Yes                          19 ( 8.9%)           (100.0%)   (0.0%)   

11   past_smoked           1. No                          193 (91.5%)           211        3        
     [character]           2. Yes                          18 ( 8.5%)           (98.6%)    (1.4%)   

12   alcohol               1. No                          205 (95.8%)           214        0        
     [character]           2. Yes                           9 ( 4.2%)           (100.0%)   (0.0%)   

13   nhis                  1. No                            1 ( 0.5%)           214        0        
     [character]           2. Yes (card not shown)          4 ( 1.9%)           (100.0%)   (0.0%)   
                           3. Yes (card shown)            208 (97.2%)                               
                           4. yes(Card shown)               1 ( 0.5%)                               

14   moca_score            Mean (sd) : 18.2 (5.9)         27 distinct values    214        0        
     [numeric]             min < med < max:                                     (100.0%)   (0.0%)   
                           1 < 19 < 30                                                              
                           IQR (CV) : 9 (0.3)                                                       

15   salt_add2             1. No                          129 (60.8%)           212        2        
     [character]           2. Yes                          83 (39.2%)           (99.1%)    (0.9%)   

16   physical_activity     1. No                           82 (38.3%)           214        0        
     [character]           2. Yes                         132 (61.7%)           (100.0%)   (0.0%)   

17   dura_exercise         Mean (sd) : 15.8 (17)          13 distinct values    207        7        
     [numeric]             min < med < max:                                     (96.7%)    (3.3%)   
                           0 < 10 < 60                                                              
                           IQR (CV) : 30 (1.1)                                                      

18   fruits_per_week       Mean (sd) : 3.1 (2.1)          0 : 23 (10.7%)        214        0        
     [numeric]             min < med < max:               1 : 32 (15.0%)        (100.0%)   (0.0%)   
                           0 < 3 < 7                      2 : 36 (16.8%)                            
                           IQR (CV) : 3 (0.7)             3 : 53 (24.8%)                            
                                                          4 : 25 (11.7%)                            
                                                          5 :  8 ( 3.7%)                            
                                                          6 :  9 ( 4.2%)                            
                                                          7 : 28 (13.1%)                            

19   salt_add              1. Never                       129 (60.6%)           213        1        
     [character]           2. Occasionally                 24 (11.3%)           (99.5%)    (0.5%)   
                           3. Option 2                      1 ( 0.5%)                               
                           4. Rarely                       38 (17.8%)                               
                           5. REFUSED                       1 ( 0.5%)                               
                           6. Ver often                    20 ( 9.4%)                               

20   daily_fruits          Mean (sd) : 1.3 (1)            0 :  22 (10.3%)       213        1        
     [numeric]             min < med < max:               1 : 133 (62.4%)       (99.5%)    (0.5%)   
                           0 < 1 < 7                      2 :  40 (18.8%)                           
                           IQR (CV) : 1 (0.7)             3 :  10 ( 4.7%)                           
                                                          4 :   5 ( 2.3%)                           
                                                          5 :   2 ( 0.9%)                           
                                                          7 :   1 ( 0.5%)                           

21   days_veges            Mean (sd) : 3.6 (2.4)          0 : 20 ( 9.4%)        213        1        
     [numeric]             min < med < max:               1 : 33 (15.5%)        (99.5%)    (0.5%)   
                           0 < 3 < 7                      2 : 27 (12.7%)                            
                           IQR (CV) : 4 (0.7)             3 : 33 (15.5%)                            
                                                          4 : 20 ( 9.4%)                            
                                                          5 : 19 ( 8.9%)                            
                                                          6 : 14 ( 6.6%)                            
                                                          7 : 47 (22.1%)                            

22   daily_veges           Mean (sd) : 1.6 (1.2)          0 :  12 ( 5.7%)       211        3        
     [numeric]             min < med < max:               1 : 121 (57.3%)       (98.6%)    (1.4%)   
                           0 < 1 < 7                      2 :  47 (22.3%)                           
                           IQR (CV) : 1 (0.7)             3 :  18 ( 8.5%)                           
                                                          4 :   7 ( 3.3%)                           
                                                          5 :   3 ( 1.4%)                           
                                                          7 :   3 ( 1.4%)                           

23   heart_failure         1. No                          197 (93.8%)           210        4        
     [character]           2. Yes                          13 ( 6.2%)           (98.1%)    (1.9%)   

24   stroke                1. No                          193 (93.7%)           206        8        
     [character]           2. Yes                          13 ( 6.3%)           (96.3%)    (3.7%)   

25   bmi                   Mean (sd) : 30.3 (8.5)         181 distinct values   199        15       
     [numeric]             min < med < max:                                     (93.0%)    (7.0%)   
                           15.8 < 29 < 86.1                                                         
                           IQR (CV) : 8.1 (0.3)                                                     

26   waist_circumference   Mean (sd) : 98.9 (20.6)        66 distinct values    198        16       
     [numeric]             min < med < max:                                     (92.5%)    (7.5%)   
                           33 < 101 < 160                                                           
                           IQR (CV) : 20 (0.2)                                                      

27   dura_hpt              Mean (sd) : 8 (7.1)            25 distinct values    212        2        
     [numeric]             min < med < max:                                     (99.1%)    (0.9%)   
                           0 < 6 < 40                                                               
                           IQR (CV) : 7 (0.9)                                                       

28   nifedipine            1. No                           72 (33.6%)           214        0        
     [character]           2. Yes                         142 (66.4%)           (100.0%)   (0.0%)   

29   amlodipine            1. No                          172 (80.4%)           214        0        
     [character]           2. Yes                          42 (19.6%)           (100.0%)   (0.0%)   

30   losartan              1. No                           73 (34.1%)           214        0        
     [character]           2. Yes                         141 (65.9%)           (100.0%)   (0.0%)   

31   lisinopril            1. No                          189 (88.3%)           214        0        
     [character]           2. Yes                          25 (11.7%)           (100.0%)   (0.0%)   

32   bendro                1. No                          176 (82.2%)           214        0        
     [character]           2. Yes                          38 (17.8%)           (100.0%)   (0.0%)   

33   methyldopa            1. No                          204 (95.3%)           214        0        
     [character]           2. Yes                          10 ( 4.7%)           (100.0%)   (0.0%)   

34   hydralazine           1. No                          210 (98.1%)           214        0        
     [character]           2. Yes                           4 ( 1.9%)           (100.0%)   (0.0%)   

35   metformin             1. No                          152 (71.0%)           214        0        
     [character]           2. Yes                          62 (29.0%)           (100.0%)   (0.0%)   

36   aspirin               1. No                          143 (66.8%)           214        0        
     [character]           2. Yes                          71 (33.2%)           (100.0%)   (0.0%)   

37   gliclazide            1. No                          196 (91.6%)           214        0        
     [character]           2. Yes                          18 ( 8.4%)           (100.0%)   (0.0%)   

38   atorvastatin          1. No                          153 (71.5%)           214        0        
     [character]           2. Yes                          61 (28.5%)           (100.0%)   (0.0%)   

39   pioglitazone          1. No                          204 (95.3%)           214        0        
     [character]           2. Yes                          10 ( 4.7%)           (100.0%)   (0.0%)   

40   atenolol              1. No                          211 (98.6%)           214        0        
     [character]           2. Yes                           3 ( 1.4%)           (100.0%)   (0.0%)   

41   bisoprolol            1. No                          211 (98.6%)           214        0        
     [character]           2. Yes                           3 ( 1.4%)           (100.0%)   (0.0%)   

42   glimepiride           1. No                          210 (98.1%)           214        0        
     [character]           2. Yes                           4 ( 1.9%)           (100.0%)   (0.0%)   

43   furosemide            1. No                          211 (98.6%)           214        0        
     [character]           2. Yes                           3 ( 1.4%)           (100.0%)   (0.0%)   

44   glibenclamide         1. No                          212 (99.1%)           214        0        
     [character]           2. Yes                           2 ( 0.9%)           (100.0%)   (0.0%)   

45   labetalol             1. No                          213 (99.5%)           214        0        
     [character]           2. Yes                           1 ( 0.5%)           (100.0%)   (0.0%)   

46   mixtard               1. No                          210 (98.1%)           214        0        
     [character]           2. Yes                           4 ( 1.9%)           (100.0%)   (0.0%)   

47   spironolactone        1. No                          213 (99.5%)           214        0        
     [character]           2. Yes                           1 ( 0.5%)           (100.0%)   (0.0%)   

48   moca_tertile          1. Upper Tercile               67 (31.3%)            214        0        
     [factor]              2. Middle Tercile              69 (32.2%)            (100.0%)   (0.0%)   
                           3. Lower Tercile               78 (36.4%)                                

49   acei                  1. No                          189 (88.3%)           214        0        
     [factor]              2. Yes                          25 (11.7%)           (100.0%)   (0.0%)   

50   arb                   1. No                           73 (34.1%)           214        0        
     [factor]              2. Yes                         141 (65.9%)           (100.0%)   (0.0%)   

51   bb                    1. No                          207 (96.7%)           214        0        
     [factor]              2. Yes                           7 ( 3.3%)           (100.0%)   (0.0%)   

52   ccb                   1. No                           33 (15.4%)           214        0        
     [factor]              2. Yes                         181 (84.6%)           (100.0%)   (0.0%)   

53   diuretics             1. No                          173 (80.8%)           214        0        
     [factor]              2. Yes                          41 (19.2%)           (100.0%)   (0.0%)   

54   antidiabetics         Mean (sd) : 0.4 (0.7)          0 : 150 (70.1%)       214        0        
     [integer]             min < med < max:               1 :  39 (18.2%)       (100.0%)   (0.0%)   
                           0 < 0 < 3                      2 :  24 (11.2%)                           
                           IQR (CV) : 1 (1.7)             3 :   1 ( 0.5%)                           

55   sulphonylurea         1. No                          190 (88.8%)           214        0        
     [factor]              2. Yes                          24 (11.2%)           (100.0%)   (0.0%)   

56   antihypertensives     Mean (sd) : 1.9 (0.8)          0 :  12 ( 5.6%)       214        0        
     [integer]             min < med < max:               1 :  41 (19.2%)       (100.0%)   (0.0%)   
                           0 < 2 < 5                      2 : 117 (54.7%)                           
                           IQR (CV) : 0 (0.4)             3 :  39 (18.2%)                           
                                                          4 :   4 ( 1.9%)                           
                                                          5 :   1 ( 0.5%)                           

57   hill_and_bone_score   Mean (sd) : 23.5 (4.5)         22 distinct values    197        17       
     [numeric]             min < med < max:                                     (92.1%)    (7.9%)   
                           16 < 23 < 48                                                             
                           IQR (CV) : 4 (0.2)                                                       

58   sbp1                  Mean (sd) : 145 (21.3)         58 distinct values    185        29       
     [numeric]             min < med < max:                                     (86.4%)    (13.6%)  
                           92 < 140 < 228                                                           
                           IQR (CV) : 25 (0.1)                                                      

59   sbp2                  Mean (sd) : 143 (22.6)         69 distinct values    186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           79 < 140 < 217                                                           
                           IQR (CV) : 24.8 (0.2)                                                    

60   sbp3                  Mean (sd) : 143.1 (22.2)       64 distinct values    186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           90 < 140 < 230                                                           
                           IQR (CV) : 22.8 (0.2)                                                    

61   sbp4                  Mean (sd) : 141.7 (19.5)       55 distinct values    179        35       
     [numeric]             min < med < max:                                     (83.6%)    (16.4%)  
                           100 < 140 < 213                                                          
                           IQR (CV) : 20.5 (0.1)                                                    

62   sbp5                  Mean (sd) : 141.4 (20.3)       52 distinct values    179        35       
     [numeric]             min < med < max:                                     (83.6%)    (16.4%)  
                           100 < 140 < 210                                                          
                           IQR (CV) : 20 (0.1)                                                      

63   sbp6                  Mean (sd) : 142.6 (22.3)       52 distinct values    179        35       
     [numeric]             min < med < max:                                     (83.6%)    (16.4%)  
                           92 < 140 < 233                                                           
                           IQR (CV) : 29 (0.2)                                                      

64   sbp7                  Mean (sd) : 142.1 (18.9)       52 distinct values    177        37       
     [numeric]             min < med < max:                                     (82.7%)    (17.3%)  
                           100 < 140 < 193                                                          
                           IQR (CV) : 23 (0.1)                                                      

65   sbp8                  Mean (sd) : 143.9 (20.6)       57 distinct values    171        43       
     [numeric]             min < med < max:                                     (79.9%)    (20.1%)  
                           90 < 140 < 212                                                           
                           IQR (CV) : 26 (0.1)                                                      

66   sbp9                  Mean (sd) : 144.8 (24.2)       56 distinct values    170        44       
     [numeric]             min < med < max:                                     (79.4%)    (20.6%)  
                           78 < 140 < 250                                                           
                           IQR (CV) : 27.8 (0.2)                                                    

67   sbp10                 Mean (sd) : 141.5 (22.9)       46 distinct values    154        60       
     [numeric]             min < med < max:                                     (72.0%)    (28.0%)  
                           100 < 140 < 240                                                          
                           IQR (CV) : 24 (0.2)                                                      

68   sbp_sd                Mean (sd) : 15.8 (7)           178 distinct values   186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           3 < 15.1 < 39.3                                                          
                           IQR (CV) : 8.9 (0.4)                                                     

69   sbp_mean              Mean (sd) : 143.2 (14.3)       159 distinct values   186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           104 < 141.8 < 196                                                        
                           IQR (CV) : 17.8 (0.1)                                                    

70   dbp1                  Mean (sd) : 85.6 (14.8)        50 distinct values    185        29       
     [numeric]             min < med < max:                                     (86.4%)    (13.6%)  
                           58 < 85 < 140                                                            
                           IQR (CV) : 13 (0.2)                                                      

71   dbp2                  Mean (sd) : 84.7 (15.4)        52 distinct values    186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           49 < 86.5 < 140                                                          
                           IQR (CV) : 15 (0.2)                                                      

72   dbp3                  Mean (sd) : 84.3 (14.5)        49 distinct values    186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           50 < 83.5 < 133                                                          
                           IQR (CV) : 14 (0.2)                                                      

73   dbp4                  Mean (sd) : 85.6 (15.2)        45 distinct values    178        36       
     [numeric]             min < med < max:                                     (83.2%)    (16.8%)  
                           20 < 87.5 < 144                                                          
                           IQR (CV) : 12.5 (0.2)                                                    

74   dbp5                  Mean (sd) : 84.6 (15)          39 distinct values    179        35       
     [numeric]             min < med < max:                                     (83.6%)    (16.4%)  
                           60 < 83 < 173                                                            
                           IQR (CV) : 15 (0.2)                                                      

75   dbp6                  Mean (sd) : 86.4 (13.4)        44 distinct values    179        35       
     [numeric]             min < med < max:                                     (83.6%)    (16.4%)  
                           46 < 90 < 134                                                            
                           IQR (CV) : 10 (0.2)                                                      

76   dbp7                  Mean (sd) : 85.6 (10.7)        39 distinct values    175        39       
     [numeric]             min < med < max:                                     (81.8%)    (18.2%)  
                           56 < 90 < 116                                                            
                           IQR (CV) : 10 (0.1)                                                      

77   dbp8                  Mean (sd) : 85.5 (13.9)        45 distinct values    170        44       
     [numeric]             min < med < max:                                     (79.4%)    (20.6%)  
                           39 < 89.5 < 121                                                          
                           IQR (CV) : 13.8 (0.2)                                                    

78   dbp9                  Mean (sd) : 86.8 (14.5)        40 distinct values    169        45       
     [numeric]             min < med < max:                                     (79.0%)    (21.0%)  
                           51 < 90 < 160                                                            
                           IQR (CV) : 10 (0.2)                                                      

79   dbp10                 Mean (sd) : 86.4 (16.5)        40 distinct values    154        60       
     [numeric]             min < med < max:                                     (72.0%)    (28.0%)  
                           50 < 84 < 191                                                            
                           IQR (CV) : 11 (0.2)                                                      

80   dbp_sd                Mean (sd) : 10.8 (5)           174 distinct values   186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           1.5 < 10 < 40.2                                                          
                           IQR (CV) : 5.5 (0.5)                                                     

81   dbp_mean              Mean (sd) : 85.7 (9.3)         149 distinct values   186        28       
     [numeric]             min < med < max:                                     (86.9%)    (13.1%)  
                           64.8 < 85 < 128.3                                                        
                           IQR (CV) : 9.6 (0.1)                                                     

82   body_weight           Mean (sd) : 76.4 (17.1)        85 distinct values    213        1        
     [numeric]             min < med < max:                                     (99.5%)    (0.5%)   
                           42 < 76 < 148                                                            
                           IQR (CV) : 20 (0.2)                                                      

83   height                Mean (sd) : 159 (10.1)         38 distinct values    200        14       
     [numeric]             min < med < max:                                     (93.5%)    (6.5%)   
                           97 < 159 < 183                                                           
                           IQR (CV) : 10 (0.1)                                                      

84   low_moca              1. No                          136 (63.6%)           214        0        
     [factor]              2. Yes                          78 (36.4%)           (100.0%)   (0.0%)   

85   controlled_bp         1. Controlled                   75 (40.3%)           186        28       
     [factor]              2. Uncontrolled                111 (59.7%)           (86.9%)    (13.1%)  
----------------------------------------------------------------------------------------------------

Table 1

Code
gtsummary::theme_gtsummary_compact()
Setting theme `Compact`
Code
df_hptcog %>% 
    gtsummary::tbl_summary(
        include = c(
            ageyrs, sex, resid, educ2, income2, dm2, ever_smoked, alcohol, 
            salt_add2, physical_activity, dura_exercise, fruits_per_week, 
            daily_fruits, days_veges, daily_veges, heart_failure, stroke, bmi, 
            waist_circumference, dura_hpt, acei, arb, bb, ccb, diuretics, 
            methyldopa, hydralazine, antidiabetics, metformin, sulphonylurea,
            pioglitazone, mixtard, atorvastatin, aspirin, antihypertensives, 
            hill_and_bone_score, sbp_sd, dbp_sd
            ),
        statistic = list(
            gtsummary::all_continuous()~"{mean} ({sd})",
            gtsummary::all_categorical()~"{n} ({p})"
        ),
        digits = list(
            gtsummary::all_categorical()~c(0, 1),
            gtsummary::all_continuous()~1),
        by = moca_tertile, 
        missing_text = "Missing",
        type = list(
            fruits_per_week ~ "continuous",
            daily_fruits ~ "continuous",
            days_veges ~ "continuous",
            daily_veges ~ "continuous",
            antihypertensives ~ "continuous",
            antidiabetics ~ "continuous"
            )
        ) %>% 
    gtsummary::bold_labels() %>%
    gtsummary::modify_spanning_header(
        gtsummary::all_stat_cols() ~ "**MOCA Score**"
        ) %>% 
    gtsummary::add_p(
        pvalue_fun = ~ gtsummary::style_pvalue(.x, digits = 3),
        test = list(
            gtsummary::all_categorical() ~ "chsqft",
            gtsummary::all_continuous() ~ "clmft"
            )
        ) %>% 
    gtsummary::modify_caption(
        "Table 1: Comparison of demographic and clinical characteristics of 
        patients by MOCA score"
    ) %>% 
    gtsummary::bold_p()
Table 1: Comparison of demographic and clinical characteristics of patients by MOCA score
Characteristic MOCA Score p-value2
Upper Tercile, N = 671 Middle Tercile, N = 691 Lower Tercile, N = 781
Age in years 58.9 (11.6) 64.9 (12.0) 67.6 (14.8) <0.001
Sex


<0.001
    Male 23 (34.3) 14 (20.3) 8 (10.3)
    Female 44 (65.7) 55 (79.7) 70 (89.7)
Residence


0.648
    Rural 7 (10.6) 3 (4.3) 15 (19.2)
    Peri urban 5 (7.6) 7 (10.1) 6 (7.7)
    Urban 54 (81.8) 59 (85.5) 57 (73.1)
    Missing 1 0 0
Educational level


<0.001
    None 10 (14.9) 31 (46.3) 58 (74.4)
    Primary 9 (13.4) 5 (7.5) 10 (12.8)
    Secondary 43 (64.2) 27 (40.3) 9 (11.5)
    Tertiary 5 (7.5) 4 (6.0) 1 (1.3)
    Missing 0 2 0
Income


0.711
    <100 GHc 5 (7.5) 2 (2.9) 5 (6.4)
    100-500GHc 18 (26.9) 19 (27.5) 27 (34.6)
    500-1000 GHc 21 (31.3) 23 (33.3) 25 (32.1)
    >1000 GHc 12 (17.9) 7 (10.1) 2 (2.6)
    Unknown 11 (16.4) 18 (26.1) 19 (24.4)
Diabetes Mellitus 33 (50.0) 33 (47.8) 33 (43.4) 0.429
    Missing 1 0 2
Ever smoked 7 (10.4) 7 (10.1) 5 (6.4) 0.384
Alcohol intake 4 (6.0) 3 (4.3) 2 (2.6) 0.307
Salt added to food 26 (39.4) 24 (34.8) 33 (42.9) 0.644
    Missing 1 0 1
Physical activity 46 (68.7) 42 (60.9) 44 (56.4) 0.133
Daily minutes exercising 19.6 (18.7) 13.5 (14.2) 14.5 (17.3) 0.073
    Missing 0 4 3
Days of Fruit per week 3.2 (2.3) 3.2 (2.1) 2.8 (2.0) 0.288
Daily Fruit servings 1.4 (0.9) 1.2 (0.8) 1.4 (1.2) 0.943
    Missing 0 1 0
Days/week vegetables 3.5 (2.5) 3.7 (2.4) 3.6 (2.4) 0.769
    Missing 0 0 1
Daily vegetable servings 1.7 (1.4) 1.3 (0.7) 1.7 (1.2) 0.915
    Missing 0 1 2
Heart failure 4 (6.2) 3 (4.3) 6 (7.9) 0.644
    Missing 2 0 2
Stroke 4 (6.3) 3 (4.5) 6 (8.0) 0.648
    Missing 3 2 3
BMI 31.7 (11.3) 29.8 (5.5) 29.6 (7.8) 0.150
    Missing 4 6 5
Waist Circunference 98.4 (21.4) 98.4 (16.9) 99.7 (22.9) 0.679
    Missing 4 4 8
Duration of hypertension in years 7.3 (7.2) 8.8 (7.6) 7.8 (6.4) 0.723
    Missing 0 0 2
ACE-Inhibitors 10 (14.9) 10 (14.5) 5 (6.4) 0.103
ARB use 46 (68.7) 40 (58.0) 55 (70.5) 0.758
Beta-Blockers use 1 (1.5) 1 (1.4) 5 (6.4) 0.089
Calcium Channel Blockers 57 (85.1) 62 (89.9) 62 (79.5) 0.321
Diuretics 13 (19.4) 13 (18.8) 15 (19.2) 0.982
Methyldopa 6 (9.0) 2 (2.9) 2 (2.6) 0.075
Hydralazine 2 (3.0) 2 (2.9) 0 (0.0) 0.175
No. of antidiabetics 0.6 (0.8) 0.4 (0.7) 0.3 (0.6) 0.021
Metformin 26 (38.8) 19 (27.5) 17 (21.8) 0.025
Sulphonylurea 11 (16.4) 7 (10.1) 6 (7.7) 0.100
Thiazolidinedione 2 (3.0) 3 (4.3) 5 (6.4) 0.327
Insulin 2 (3.0) 1 (1.4) 1 (1.3) 0.459
Statin 20 (29.9) 20 (29.0) 21 (26.9) 0.694
Antiplatelet 26 (38.8) 16 (23.2) 29 (37.2) 0.909
No. of Antihypertensive 2.0 (0.9) 1.9 (0.7) 1.9 (0.9) 0.180
Hillbone score 24.2 (4.3) 22.8 (3.9) 23.5 (5.2) 0.432
    Missing 7 4 6
Systolic variability 14.9 (6.1) 15.4 (7.0) 16.8 (7.6) 0.120
    Missing 4 16 8
Diastolic variability 10.4 (4.5) 10.1 (4.2) 11.7 (5.9) 0.120
    Missing 4 16 8
1 Mean (SD); n (%)
2 Ordinal Cumulative Link Model; Chi-square trend test

Table 2

Please Note
  1. Do we intend to dichotomise the MOCA? If we are looking for trend analysis then Table I does that?
  2. How do I derive the following variables? Systolic BP, Diastolic BP, Controlled hypertension, Uncontrolled hypertension,
  3. What should be the cut-off for inclusion into the multivariate model
Code
gtsummary::tbl_uvregression(
    df_hptcog,
    include = c(
        ageyrs, sex, educ2, dura_hpt, sbp_mean, dbp_mean, controlled_bp, alcohol, 
        dm2, ever_smoked, stroke, heart_failure, dura_exercise, fruits_per_week, 
        physical_activity, bmi,antihypertensives, hill_and_bone_score
        ),
    method  = glm,
    y = low_moca,
    method.args = list(family = binomial),
    exponentiate = TRUE,
    pvalue_fun = function(x) gtsummary::style_pvalue(x, digits = 3)
    ) %>% 
gtsummary::bold_labels() %>% 
gtsummary::bold_p()
Characteristic N OR1 95% CI1 p-value
Age in years 214 1.03 1.01, 1.06 0.003
Sex 214


    Male

    Female
3.27 1.50, 7.95 0.005
Educational level 212


    None

    Primary
0.50 0.20, 1.24 0.139
    Secondary
0.09 0.04, 0.19 <0.001
    Tertiary
0.08 0.00, 0.44 0.018
Diabetes Mellitus 211


    No

    Yes
0.80 0.45, 1.41 0.445
Ever smoked 214


    No

    Yes
0.60 0.19, 1.63 0.341
Alcohol intake 214


    No

    Yes
0.48 0.07, 2.07 0.374
Physical activity 214


    No

    Yes
0.71 0.40, 1.25 0.230
Daily minutes exercising 207 0.99 0.97, 1.01 0.382
Days of Fruit per week 214 0.92 0.80, 1.05 0.228
Heart failure 210


    No

    Yes
1.56 0.48, 4.86 0.443
Stroke 206


    No

    Yes
1.54 0.48, 4.82 0.453
BMI 199 0.98 0.95, 1.02 0.376
Duration of hypertension in years 212 1.0 0.95, 1.03 0.793
No. of Antihypertensive 214 0.85 0.61, 1.19 0.352
Hillbone score 197 1.00 0.94, 1.07 0.993
Systolic Blood Pressure 186 1.01 0.99, 1.03 0.354
Diastolic Blood Pressure 186 0.99 0.95, 1.02 0.412
Controlled Blood Pressure 186


    Controlled

    Uncontrolled
1.24 0.68, 2.29 0.493
1 OR = Odds Ratio, CI = Confidence Interval

Table 3

Please Note
  1. How do I derive the following variables? Systolic BP, Diastolic BP, Controlled hypertension, Uncontrolled hypertension
  2. What should be the cut-off for inclusion into the multivariable model
Code
gtsummary::tbl_uvregression(
    df_hptcog,
    include = c(
        ageyrs, sex, educ2, dura_hpt, sbp_mean, dbp_mean, controlled_bp, alcohol, 
        dm2, ever_smoked, stroke, heart_failure, dura_exercise, fruits_per_week, 
        physical_activity, bmi, antihypertensives, hill_and_bone_score
        ),
    method  = glm,
    y = moca_score,
    method.args = list(family = gaussian),
    exponentiate = FALSE,
    pvalue_fun = function(x) gtsummary::style_pvalue(x, digits = 3)
    ) %>% 
gtsummary::bold_labels() %>% 
gtsummary::bold_p()
Characteristic N Beta 95% CI1 p-value
Age in years 214 -0.13 -0.18, -0.07 <0.001
Sex 214


    Male

    Female
-3.2 -5.1, -1.3 0.001
Educational level 212


    None

    Primary
2.5 0.16, 4.8 0.037
    Secondary
6.3 4.7, 7.8 <0.001
    Tertiary
6.6 3.2, 10 <0.001
Diabetes Mellitus 211


    No

    Yes
0.63 -0.96, 2.2 0.437
Ever smoked 214


    No

    Yes
1.8 -1.0, 4.6 0.211
Alcohol intake 214


    No

    Yes
2.7 -1.3, 6.6 0.186
Physical activity 214


    No

    Yes
1.6 -0.07, 3.2 0.062
Daily minutes exercising 207 0.04 -0.01, 0.09 0.085
Days of Fruit per week 214 0.36 -0.01, 0.74 0.059
Heart failure 210


    No

    Yes
-2.4 -5.8, 0.86 0.148
Stroke 206


    No

    Yes
-2.4 -5.8, 0.87 0.150
BMI 199 0.08 -0.02, 0.18 0.120
Duration of hypertension in years 212 0.01 -0.11, 0.12 0.903
No. of Antihypertensive 214 0.34 -0.60, 1.3 0.476
Hillbone score 197 0.01 -0.18, 0.19 0.948
Systolic Blood Pressure 186 -0.02 -0.09, 0.04 0.454
Diastolic Blood Pressure 186 0.07 -0.03, 0.16 0.164
Controlled Blood Pressure 186


    Controlled

    Uncontrolled
-0.59 -2.4, 1.2 0.526
1 CI = Confidence Interval

Table 4 - Sensitivity analysis

Code
tbl_female <-
    gtsummary::tbl_uvregression(
    df_hptcog %>% filter(sex == "Female"),
    include = c(
        ageyrs, educ2, dura_hpt, sbp_mean, dbp_mean, controlled_bp, alcohol, 
        dm2, ever_smoked, stroke, heart_failure, dura_exercise, fruits_per_week, 
        physical_activity, bmi, antihypertensives, hill_and_bone_score
        ),
    method  = glm,
    y = moca_score,
    method.args = list(family = gaussian),
    exponentiate = FALSE,
    pvalue_fun = function(x) gtsummary::style_pvalue(x, digits = 3)
    ) %>% 
gtsummary::bold_labels() %>% 
gtsummary::bold_p()

tbl_male <-
    gtsummary::tbl_uvregression(
    df_hptcog %>% filter(sex == "Male"),
    include = c(
        ageyrs, educ2, dura_hpt, sbp_mean, dbp_mean, controlled_bp, alcohol, 
        dm2, ever_smoked, stroke, heart_failure, dura_exercise, fruits_per_week, 
        physical_activity, bmi, antihypertensives, hill_and_bone_score
        ),
    method  = glm,
    y = moca_score,
    method.args = list(family = gaussian),
    exponentiate = FALSE,
    pvalue_fun = function(x) gtsummary::style_pvalue(x, digits = 3)
    ) %>% 
gtsummary::bold_labels() %>% 
gtsummary::bold_p()

gtsummary::tbl_merge(
    tbls = list(tbl_female, tbl_male),
    tab_spanner = c("**Female**", "**Male**"))
Characteristic Female Male
N Beta 95% CI1 p-value N Beta 95% CI1 p-value
Age in years 169 -0.15 -0.21, -0.09 <0.001 45 -0.14 -0.27, -0.01 0.041
Educational level 168


44


    None



    Primary
0.99 -1.5, 3.5 0.446
8.6 3.6, 14 0.002
    Secondary
5.6 3.9, 7.3 <0.001
8.3 4.8, 12 <0.001
    Tertiary
13 7.5, 18 <0.001
3.2 -1.5, 8.0 0.193
Diabetes Mellitus 166


45


    No



    Yes
0.88 -0.91, 2.7 0.335
-1.6 -4.9, 1.6 0.324
Ever smoked 169


45


    No



    Yes
-1.0 -5.0, 2.9 0.606
2.7 -1.1, 6.5 0.178
Alcohol intake 169


45


    No



    Yes
2.7 -1.7, 7.2 0.234
2.4 -5.4, 10 0.554
Physical activity 169


45


    No



    Yes
1.6 -0.27, 3.4 0.096
2.6 -0.51, 5.8 0.109
Daily minutes exercising 163 0.04 -0.02, 0.09 0.170 44 0.07 -0.02, 0.16 0.118
Days of Fruit per week 169 0.45 0.04, 0.86 0.032 45 0.49 -0.34, 1.3 0.250
Heart failure 166


44


    No



    Yes
0.55 -3.4, 4.5 0.786
-11 -15, -5.9 <0.001
Stroke 162


44


    No



    Yes
0.57 -3.4, 4.6 0.780
-11 -15, -5.9 <0.001
BMI 158 0.18 0.08, 0.29 <0.001 41 -0.31 -0.49, -0.13 0.002
Duration of hypertension in years 167 -0.02 -0.15, 0.11 0.741 45 0.06 -0.14, 0.27 0.549
No. of Antihypertensive 169 -0.21 -1.3, 0.92 0.711 45 2.5 1.0, 4.0 0.002
Hillbone score 153 -0.05 -0.26, 0.15 0.610 44 0.19 -0.17, 0.54 0.311
Systolic Blood Pressure 144 -0.02 -0.09, 0.05 0.531 42 -0.05 -0.16, 0.07 0.424
Diastolic Blood Pressure 144 0.07 -0.05, 0.18 0.238 42 0.06 -0.09, 0.21 0.455
Controlled Blood Pressure 144


42


    Controlled



    Uncontrolled
0.03 -2.0, 2.1 0.974
-3.5 -6.9, -0.15 0.047
1 CI = Confidence Interval

Table 4B

Code
 tbl_female_2 <-
     df_hptcog %>% 
     filter(sex == "Female") %>% 
     select(moca_score, ageyrs, educ2, fruits_per_week, bmi) %>% 
     lm(moca_score ~ ., data = .) %>% 
    gtsummary::tbl_regression(
        pvalue_fun = function(x) gtsummary::style_pvalue(x, digits = 3)
        ) %>%
    gtsummary::modify_header(
        update = list(
            estimate ~ "**Estimate**",
            label ~ "**Variable**")
            ) %>%
    gtsummary::modify_caption(
        caption = "**Table XI:** Multivariate linear regression"
        ) %>%
    gtsummary::bold_labels() %>%
    gtsummary::bold_p()

 tbl_male_2 <-
     df_hptcog %>% 
     filter(sex == "Male") %>% 
     mutate(
        stroke = factor(stroke), 
        heart_failure=factor(heart_failure),
        controlled_bp = ifelse(controlled_bp == "Controlled", "Yes", "No") %>% 
            factor()
        ) %>% 
     select(
        moca_score, ageyrs, educ2, stroke, bmi, heart_failure,
        antihypertensives, controlled_bp
        ) %>% 
     lm(moca_score ~ ., data = .) %>% 
     gtsummary::tbl_regression(
        pvalue_fun = function(x) gtsummary::style_pvalue(x, digits = 3),
        label = list(
            heart_failure ~ "Heart Failure", 
            stroke ~ "Stroke", 
            controlled_bp = "Controlled BP"),
        show_single_row = c(heart_failure, stroke, controlled_bp)
        ) %>%
     gtsummary::modify_header(
        update = list(
            estimate ~ "**Estimate**",
            label ~ "**Variable**")
            ) %>%
    gtsummary::modify_caption(
        caption = "**Table XI:** Multivariate linear regression"
        ) %>%
    gtsummary::bold_labels() %>%
    gtsummary::bold_p()


gtsummary::tbl_merge(
    tbls = list(tbl_female_2, tbl_male_2),
    tab_spanner = c("**Female**", "**Male**"))
Table XI: Multivariate linear regression
Variable Female Male
Estimate 95% CI1 p-value Estimate 95% CI1 p-value
Age in years -0.08 -0.14, -0.02 0.014 -0.09 -0.23, 0.05 0.202
Educational level





    None

    Primary 0.37 -2.2, 3.0 0.780 6.0 -0.79, 13 0.081
    Secondary 4.7 2.9, 6.5 <0.001 5.0 -0.70, 11 0.083
    Tertiary 10 4.0, 16 0.001 -3.6 -11, 3.7 0.318
Days of Fruit per week 0.27 -0.10, 0.63 0.151


BMI 0.08 -0.02, 0.18 0.114 0.09 -0.25, 0.43 0.592
Stroke


-7.0 -16, 2.2 0.131
Heart Failure





No. of Antihypertensive


0.25 -1.5, 2.0 0.771
Controlled BP


2.3 -0.92, 5.5 0.153
1 CI = Confidence Interval