final_project_rule_learning.Rmd.

1 Rule Learning

1.1 Apriori Helper Functions and Libraries

library(arules)
library(arulesViz)

# translate the obscure descriptions into the descriptive descriptions
join_descriptions <- function(df, df_stat) {
  df_new <- df
  colname <- colnames(df_new)
  colname <- colname[!colname %in% "PositiveChange"]
  for(i in 1:length(colname)) {
    if(is.null(attributes(df_stat[[colname[i]]])$class) == F && attributes(df_stat[[colname[i]]])$class != "factor" && attributes(df_stat[[colname[i]]])$class[3] == "double") {
      if(is.null(attributes(df_stat[[colname[i]]])$labels) == F && length(attributes(df_stat[[colname[i]]])$labels) > 0) {
        vect_labels <- attributes(df_stat[[colname[i]]])$labels
        df_new[colname[i]] <- lapply(df_new[colname[i]], as.character)
        for(l in 1:length(vect_labels)) {
          df_new[colname[i]] <- replace(df_new[colname[i]], df_new[colname[i]] == vect_labels[l], trimws(names(vect_labels)[l]))
        }
      }
    }
  }
  return(df_new)
}

# translate the transactions with the obscure descriptions into the descriptive descriptions
tranasctions_join_descriptions <- function(trans) {
  subbed_trans <- trans
  vect_label <- attr(subbed_trans, "itemInfo")[["labels"]]
  for(i in 1:length(vect_label)) {
    attr(subbed_trans, "itemInfo")[["labels"]][i] <- paste0(string_replace_description(vect_label[i], reg = "\\w+\\="), "|u", i)
  }
  attr(subbed_trans, "itemInfo")[["variables"]] <- as.factor(unlist(lapply(attr(subbed_trans, "itemInfo")[["variables"]], fieldname_to_description)))
  attr(subbed_trans, "itemInfo")[["levels"]] <- unlist(lapply(attr(subbed_trans, "itemInfo")[["levels"]], string_replace_description, reg = "\\w+\\="))
  return(subbed_trans)
}

# replace an apriori string / description with the descriptive fieldnames (not the obscure fieldnames)
string_replace_description <- function(sub, reg) {
  vect_strings <- unlist(str_split(sub, "="))
  new_reg <- str_replace(reg, "\\\\=", "$")
  for(i in 1:length(vect_strings)) {
    extracted <- str_extract(vect_strings[i], new_reg)
    if(!is.na(extracted) && length(extracted) > 0)
      vect_strings[i] <- str_replace(vect_strings[i], extracted, fieldname_to_description(extracted))
  }
  # str_extract(sub, reg)
  # extracted <- gsub("[[:punct:]]+", "", extracted)
  # sub <- str_replace(sub, extracted, fieldname_to_description(extracted))
  return(paste(vect_strings, collapse="="))
}

1.2 Apriori Learning - Full Dataset

num_rules_full <- 45
df_full_apriori <- join_descriptions(df_full_na, tbl_dta)
transactions_full <- transactions(df_full_apriori)
# summary(transactions_full)
# inspect(transactions_full[1:2,])
transactions_full_subbed <- tranasctions_join_descriptions(transactions_full)
#itemFrequency(transactions_full_subbed[,1:5])

##for rules
myrules_full <- apriori(transactions_full_subbed, parameter = list(support = 0.25))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.8    0.1    1 none FALSE            TRUE       5    0.25      1
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 491 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[1186 item(s), 1966 transaction(s)] done [0.13s].
## sorting and recoding items ... [300 item(s)] done [0.01s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [49.62s].
## writing ... [84285254 rule(s)] done [11.08s].
## creating S4 object  ... done [23.48s].
myrules_full_sorted <- sort(myrules_full, by="lift")
myrules_full_sorted
## set of 84285254 rules
# summary(myrules_full)
inspect(head(myrules_full_sorted, n = num_rules_full))
##      lhs                                                                                                                                            rhs                                                                                                                                           support confidence  coverage     lift count
## [1]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [2]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [3]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [4]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [5]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [6]  {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [7]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [8]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [9]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [10] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [11] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [12] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [13] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [14] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [15] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [16] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [17] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801,                                                                                                                                                                                                
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [18] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [19] {Ever tried chew tobacco 02=No|u331,                                                                                                                                                                                                                                                                                                    
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2619532          1 0.2619532 3.207178   515
## [20] {Ever tried chew tobacco 02=No|u331,                                                                                                                                                                                                                                                                                                    
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2619532          1 0.2619532 3.207178   515
## [21] {Ever tried inhalants 02=No|u346,                                                                                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2782299          1 0.2782299 3.207178   547
## [22] {Ever tried inhalants 02=No|u346,                                                                                                                                                                                                                                                                                                       
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2782299          1 0.2782299 3.207178   547
## [23] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u695,                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2527976          1 0.2527976 3.207178   497
## [24] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u695,                                                                                                                                                                                                                                       
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2527976          1 0.2527976 3.207178   497
## [25] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       Completed education of mother=Actual years of education|u1119}                                                                             => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2512716          1 0.2512716 3.207178   494
## [26] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       Completed education of mother=Actual years of education|u1119}                                                                             => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2512716          1 0.2512716 3.207178   494
## [27] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       K15 how often drove when drunk or high=Never|u994}                                                                                         => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2650051          1 0.2650051 3.207178   521
## [28] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       K15 how often drove when drunk or high=Never|u994}                                                                                         => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2650051          1 0.2650051 3.207178   521
## [29] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       K13 how often got into physical fight=Never|u987}                                                                                          => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2792472          1 0.2792472 3.207178   549
## [30] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       K13 how often got into physical fight=Never|u987}                                                                                          => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2792472          1 0.2792472 3.207178   549
## [31] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2558494          1 0.2558494 3.207178   503
## [32] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                       
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2558494          1 0.2558494 3.207178   503
## [33] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                     
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2522889          1 0.2522889 3.207178   496
## [34] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                     
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2522889          1 0.2522889 3.207178   496
## [35] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                      
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2858596          1 0.2858596 3.207178   562
## [36] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                      
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2858596          1 0.2858596 3.207178   562
## [37] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                  
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2817904          1 0.2817904 3.207178   554
## [38] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                  
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2817904          1 0.2817904 3.207178   554
## [39] {H16 wtr>2 wks no interest in life=[0,1]|u793,                                                                                                                                                                                                                                                                                          
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2772126          1 0.2772126 3.207178   545
## [40] {H16 wtr>2 wks no interest in life=[0,1]|u793,                                                                                                                                                                                                                                                                                          
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2772126          1 0.2772126 3.207178   545
## [41] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u724,                                                                                                                                                                                                                 
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2772126          1 0.2772126 3.207178   545
## [42] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u724,                                                                                                                                                                                                                 
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2772126          1 0.2772126 3.207178   545
## [43] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                              
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2914547          1 0.2914547 3.207178   573
## [44] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                              
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2914547          1 0.2914547 3.207178   573
## [45] {Whether sample or nonsample=This individual is born-in sample (ER30002=030-169)|u8,                                                                                                                                                                                                                                                    
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2522889          1 0.2522889 3.207178   496
plot(myrules_full_sorted, method = "graph", engine = "htmlwidget", control = list(main = list(title="Rules for the Full Dataset")), max = num_rules_full)
## Available control parameters (with default values):
## itemCol   =  #CBD2FC
## nodeCol   =  c("#EE0000", "#EE0303", "#EE0606", "#EE0909", "#EE0C0C", "#EE0F0F", "#EE1212", "#EE1515", "#EE1818", "#EE1B1B", "#EE1E1E", "#EE2222", "#EE2525", "#EE2828", "#EE2B2B", "#EE2E2E", "#EE3131", "#EE3434", "#EE3737", "#EE3A3A", "#EE3D3D", "#EE4040", "#EE4444", "#EE4747", "#EE4A4A", "#EE4D4D", "#EE5050", "#EE5353", "#EE5656", "#EE5959", "#EE5C5C", "#EE5F5F", "#EE6262", "#EE6666", "#EE6969", "#EE6C6C", "#EE6F6F", "#EE7272", "#EE7575", "#EE7878", "#EE7B7B", "#EE7E7E", "#EE8181", "#EE8484", "#EE8888", "#EE8B8B",  "#EE8E8E", "#EE9191", "#EE9494", "#EE9797", "#EE9999", "#EE9B9B", "#EE9D9D", "#EE9F9F", "#EEA0A0", "#EEA2A2", "#EEA4A4", "#EEA5A5", "#EEA7A7", "#EEA9A9", "#EEABAB", "#EEACAC", "#EEAEAE", "#EEB0B0", "#EEB1B1", "#EEB3B3", "#EEB5B5", "#EEB7B7", "#EEB8B8", "#EEBABA", "#EEBCBC", "#EEBDBD", "#EEBFBF", "#EEC1C1", "#EEC3C3", "#EEC4C4", "#EEC6C6", "#EEC8C8", "#EEC9C9", "#EECBCB", "#EECDCD", "#EECFCF", "#EED0D0", "#EED2D2", "#EED4D4", "#EED5D5", "#EED7D7", "#EED9D9", "#EEDBDB", "#EEDCDC", "#EEDEDE", "#EEE0E0",  "#EEE1E1", "#EEE3E3", "#EEE5E5", "#EEE7E7", "#EEE8E8", "#EEEAEA", "#EEECEC", "#EEEEEE")
## precision     =  3
## igraphLayout  =  layout_nicely
## interactive   =  TRUE
## engine    =  visNetwork
## max   =  100
## selection_menu    =  TRUE
## degree_highlight  =  1
## verbose   =  FALSE
# Runs out of Memory
#plot(myrules_full, method = "grouped matrix", k = 7, rhs_max = 5, engine = "htmlwidget")

1.3 Apriori Learning - Objective Dataset

num_rules_objective <- 45
df_objective_apriori <- join_descriptions(df_objective_na, tbl_dta)
transactions_objective <- transactions(df_objective_apriori)
# summary(transactions_objective)
# inspect(transactions_objective[1:2,])
transactions_objective_subbed <- tranasctions_join_descriptions(transactions_objective)
#itemFrequency(transactions_objective_subbed[,1:5])

myrules_objective <- apriori(transactions_objective_subbed, parameter = list(support = 0.25))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.8    0.1    1 none FALSE            TRUE       5    0.25      1
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 491 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[907 item(s), 1966 transaction(s)] done [0.08s].
## sorting and recoding items ... [240 item(s)] done [0.01s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [23.97s].
## writing ... [37117948 rule(s)] done [4.86s].
## creating S4 object  ... done [9.40s].
myrules_objective_sorted <- sort(myrules_objective, by="lift")
myrules_objective_sorted
## set of 37117948 rules
# summary(myrules_objective_sorted)
inspect(head(sort(myrules_objective_sorted, by="lift"), n = num_rules_objective))
##      lhs                                                                                                                                             rhs                                                                                                                                           support confidence  coverage     lift count
## [1]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [2]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [3]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [4]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}             => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [5]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [6]  {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}     => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [7]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [8]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}             => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [9]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [10] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}     => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [11] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}             => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [12] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}     => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [13] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [14] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606,                                                                                                                                                                                                         
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [15] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606,                                                                                                                                                                                                         
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [16] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [17] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611,                                                                                                                                                                                                 
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [18] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611,                                                                                                                                                                                                 
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [19] {Ever tried chew tobacco 02=No|u289,                                                                                                                                                                                                                                                                                                     
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2619532          1 0.2619532 3.207178   515
## [20] {Ever tried chew tobacco 02=No|u289,                                                                                                                                                                                                                                                                                                     
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2619532          1 0.2619532 3.207178   515
## [21] {Ever tried inhalants 02=No|u304,                                                                                                                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2782299          1 0.2782299 3.207178   547
## [22] {Ever tried inhalants 02=No|u304,                                                                                                                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2782299          1 0.2782299 3.207178   547
## [23] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u564,                                                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2527976          1 0.2527976 3.207178   497
## [24] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u564,                                                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2527976          1 0.2527976 3.207178   497
## [25] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625,                                                                                                                                                                                              
##       Completed education of mother=Actual years of education|u840}                                                                               => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2512716          1 0.2512716 3.207178   494
## [26] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       Completed education of mother=Actual years of education|u840}                                                                               => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2512716          1 0.2512716 3.207178   494
## [27] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625,                                                                                                                                                                                              
##       K15 how often drove when drunk or high=Never|u804}                                                                                          => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2650051          1 0.2650051 3.207178   521
## [28] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       K15 how often drove when drunk or high=Never|u804}                                                                                          => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2650051          1 0.2650051 3.207178   521
## [29] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625,                                                                                                                                                                                              
##       K13 how often got into physical fight=Never|u797}                                                                                           => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2792472          1 0.2792472 3.207178   549
## [30] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       K13 how often got into physical fight=Never|u797}                                                                                           => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2792472          1 0.2792472 3.207178   549
## [31] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2558494          1 0.2558494 3.207178   503
## [32] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2558494          1 0.2558494 3.207178   503
## [33] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                   
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2817904          1 0.2817904 3.207178   554
## [34] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                   
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2817904          1 0.2817904 3.207178   554
## [35] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                       
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2858596          1 0.2858596 3.207178   562
## [36] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2858596          1 0.2858596 3.207178   562
## [37] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                      
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2522889          1 0.2522889 3.207178   496
## [38] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                      
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2522889          1 0.2522889 3.207178   496
## [39] {H16 wtr>2 wks no interest in life=[0,1]|u603,                                                                                                                                                                                                                                                                                           
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2772126          1 0.2772126 3.207178   545
## [40] {H16 wtr>2 wks no interest in life=[0,1]|u603,                                                                                                                                                                                                                                                                                           
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2772126          1 0.2772126 3.207178   545
## [41] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u574,                                                                                                                                                                                                                  
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2772126          1 0.2772126 3.207178   545
## [42] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u574,                                                                                                                                                                                                                  
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2772126          1 0.2772126 3.207178   545
## [43] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                               
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2914547          1 0.2914547 3.207178   573
## [44] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                               
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2914547          1 0.2914547 3.207178   573
## [45] {Whether sample or nonsample=This individual is born-in sample (ER30002=030-169)|u8,                                                                                                                                                                                                                                                     
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2522889          1 0.2522889 3.207178   496
plot(sort(myrules_objective_sorted, by="lift"), method = "graph", engine = "htmlwidget", control = list(main = list(title="Rules for the Objective Dataset")), max = num_rules_objective)
## Available control parameters (with default values):
## itemCol   =  #CBD2FC
## nodeCol   =  c("#EE0000", "#EE0303", "#EE0606", "#EE0909", "#EE0C0C", "#EE0F0F", "#EE1212", "#EE1515", "#EE1818", "#EE1B1B", "#EE1E1E", "#EE2222", "#EE2525", "#EE2828", "#EE2B2B", "#EE2E2E", "#EE3131", "#EE3434", "#EE3737", "#EE3A3A", "#EE3D3D", "#EE4040", "#EE4444", "#EE4747", "#EE4A4A", "#EE4D4D", "#EE5050", "#EE5353", "#EE5656", "#EE5959", "#EE5C5C", "#EE5F5F", "#EE6262", "#EE6666", "#EE6969", "#EE6C6C", "#EE6F6F", "#EE7272", "#EE7575", "#EE7878", "#EE7B7B", "#EE7E7E", "#EE8181", "#EE8484", "#EE8888", "#EE8B8B",  "#EE8E8E", "#EE9191", "#EE9494", "#EE9797", "#EE9999", "#EE9B9B", "#EE9D9D", "#EE9F9F", "#EEA0A0", "#EEA2A2", "#EEA4A4", "#EEA5A5", "#EEA7A7", "#EEA9A9", "#EEABAB", "#EEACAC", "#EEAEAE", "#EEB0B0", "#EEB1B1", "#EEB3B3", "#EEB5B5", "#EEB7B7", "#EEB8B8", "#EEBABA", "#EEBCBC", "#EEBDBD", "#EEBFBF", "#EEC1C1", "#EEC3C3", "#EEC4C4", "#EEC6C6", "#EEC8C8", "#EEC9C9", "#EECBCB", "#EECDCD", "#EECFCF", "#EED0D0", "#EED2D2", "#EED4D4", "#EED5D5", "#EED7D7", "#EED9D9", "#EEDBDB", "#EEDCDC", "#EEDEDE", "#EEE0E0",  "#EEE1E1", "#EEE3E3", "#EEE5E5", "#EEE7E7", "#EEE8E8", "#EEEAEA", "#EEECEC", "#EEEEEE")
## precision     =  3
## igraphLayout  =  layout_nicely
## interactive   =  TRUE
## engine    =  visNetwork
## max   =  100
## selection_menu    =  TRUE
## degree_highlight  =  1
## verbose   =  FALSE
# Runs out of Memory
# plot(myrules_objective, method = "grouped matrix", k = 7, rhs_max = 7, engine = "htmlwidget")

1.4 Summary

Based upon both the full and objective dataset, it appears the feature relationships that had the biggest impact on PositiveChange are below.

intersect(inspect(head(myrules_full_sorted, n = num_rules_objective)), inspect(head(myrules_objective_sorted, n = num_rules_objective)))
##      lhs                                                                                                                                            rhs                                                                                                                                           support confidence  coverage     lift count
## [1]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [2]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [3]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [4]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [5]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [6]  {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [7]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [8]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [9]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [10] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [11] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [12] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [13] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} 0.3118006          1 0.3118006 3.207178   613
## [14] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [15] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u815} => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [16] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    0.3118006          1 0.3118006 3.207178   613
## [17] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801,                                                                                                                                                                                                
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.3118006          1 0.3118006 3.207178   613
## [18] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u801}    => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.3118006          1 0.3118006 3.207178   613
## [19] {Ever tried chew tobacco 02=No|u331,                                                                                                                                                                                                                                                                                                    
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2619532          1 0.2619532 3.207178   515
## [20] {Ever tried chew tobacco 02=No|u331,                                                                                                                                                                                                                                                                                                    
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2619532          1 0.2619532 3.207178   515
## [21] {Ever tried inhalants 02=No|u346,                                                                                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2782299          1 0.2782299 3.207178   547
## [22] {Ever tried inhalants 02=No|u346,                                                                                                                                                                                                                                                                                                       
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2782299          1 0.2782299 3.207178   547
## [23] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u695,                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2527976          1 0.2527976 3.207178   497
## [24] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u695,                                                                                                                                                                                                                                       
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2527976          1 0.2527976 3.207178   497
## [25] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       Completed education of mother=Actual years of education|u1119}                                                                             => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2512716          1 0.2512716 3.207178   494
## [26] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       Completed education of mother=Actual years of education|u1119}                                                                             => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2512716          1 0.2512716 3.207178   494
## [27] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       K15 how often drove when drunk or high=Never|u994}                                                                                         => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2650051          1 0.2650051 3.207178   521
## [28] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       K15 how often drove when drunk or high=Never|u994}                                                                                         => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2650051          1 0.2650051 3.207178   521
## [29] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808,                                                                                                                                                                                                   
##       K13 how often got into physical fight=Never|u987}                                                                                          => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2792472          1 0.2792472 3.207178   549
## [30] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796,                                                                                                                                                                                                        
##       K13 how often got into physical fight=Never|u987}                                                                                          => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2792472          1 0.2792472 3.207178   549
## [31] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2558494          1 0.2558494 3.207178   503
## [32] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                       
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2558494          1 0.2558494 3.207178   503
## [33] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                     
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2522889          1 0.2522889 3.207178   496
## [34] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                     
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2522889          1 0.2522889 3.207178   496
## [35] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                      
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2858596          1 0.2858596 3.207178   562
## [36] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                      
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2858596          1 0.2858596 3.207178   562
## [37] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                  
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2817904          1 0.2817904 3.207178   554
## [38] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                  
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2817904          1 0.2817904 3.207178   554
## [39] {H16 wtr>2 wks no interest in life=[0,1]|u793,                                                                                                                                                                                                                                                                                          
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2772126          1 0.2772126 3.207178   545
## [40] {H16 wtr>2 wks no interest in life=[0,1]|u793,                                                                                                                                                                                                                                                                                          
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2772126          1 0.2772126 3.207178   545
## [41] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u724,                                                                                                                                                                                                                 
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2772126          1 0.2772126 3.207178   545
## [42] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u724,                                                                                                                                                                                                                 
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2772126          1 0.2772126 3.207178   545
## [43] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                              
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2914547          1 0.2914547 3.207178   573
## [44] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                              
##       H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       0.2914547          1 0.2914547 3.207178   573
## [45] {Whether sample or nonsample=This individual is born-in sample (ER30002=030-169)|u8,                                                                                                                                                                                                                                                    
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u808}       => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u796}            0.2522889          1 0.2522889 3.207178   496
##      lhs                                                                                                                                             rhs                                                                                                                                           support confidence  coverage     lift count
## [1]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [2]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [3]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [4]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}             => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [5]  {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [6]  {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}     => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [7]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [8]  {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}             => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [9]  {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [10] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}     => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [11] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}             => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [12] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}     => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [13] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606}            0.3118006          1 0.3118006 3.207178   613
## [14] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606,                                                                                                                                                                                                         
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [15] {H20b wtr covered by health insurance=Inap: R was head or wife/"wife" in the 2011 PSID interview (Head-wife status=1 or 2)|u606,                                                                                                                                                                                                         
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [16] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611}    0.3118006          1 0.3118006 3.207178   613
## [17] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611,                                                                                                                                                                                                 
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.3118006          1 0.3118006 3.207178   613
## [18] {H23a how often do vigorous activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u611,                                                                                                                                                                                                 
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.3118006          1 0.3118006 3.207178   613
## [19] {Ever tried chew tobacco 02=No|u289,                                                                                                                                                                                                                                                                                                     
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2619532          1 0.2619532 3.207178   515
## [20] {Ever tried chew tobacco 02=No|u289,                                                                                                                                                                                                                                                                                                     
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2619532          1 0.2619532 3.207178   515
## [21] {Ever tried inhalants 02=No|u304,                                                                                                                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2782299          1 0.2782299 3.207178   547
## [22] {Ever tried inhalants 02=No|u304,                                                                                                                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2782299          1 0.2782299 3.207178   547
## [23] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u564,                                                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2527976          1 0.2527976 3.207178   497
## [24] {B5d how much responsiblty managing money=I am completely responsible for this all the time|u564,                                                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2527976          1 0.2527976 3.207178   497
## [25] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625,                                                                                                                                                                                              
##       Completed education of mother=Actual years of education|u840}                                                                               => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2512716          1 0.2512716 3.207178   494
## [26] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       Completed education of mother=Actual years of education|u840}                                                                               => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2512716          1 0.2512716 3.207178   494
## [27] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625,                                                                                                                                                                                              
##       K15 how often drove when drunk or high=Never|u804}                                                                                          => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2650051          1 0.2650051 3.207178   521
## [28] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       K15 how often drove when drunk or high=Never|u804}                                                                                          => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2650051          1 0.2650051 3.207178   521
## [29] {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625,                                                                                                                                                                                              
##       K13 how often got into physical fight=Never|u797}                                                                                           => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2792472          1 0.2792472 3.207178   549
## [30] {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618,                                                                                                                                                                                                    
##       K13 how often got into physical fight=Never|u797}                                                                                           => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2792472          1 0.2792472 3.207178   549
## [31] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                        
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2558494          1 0.2558494 3.207178   503
## [32] {Left out of things 02=Not in the past month|u54,                                                                                                                                                                                                                                                                                        
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2558494          1 0.2558494 3.207178   503
## [33] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                   
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2817904          1 0.2817904 3.207178   554
## [34] {L6 hispanicity=No|u6,                                                                                                                                                                                                                                                                                                                   
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2817904          1 0.2817904 3.207178   554
## [35] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                       
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2858596          1 0.2858596 3.207178   562
## [36] {# Days ate: other protein 02=Number of days|u223,                                                                                                                                                                                                                                                                                       
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2858596          1 0.2858596 3.207178   562
## [37] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                      
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2522889          1 0.2522889 3.207178   496
## [38] {Mentor 02=No|u129,                                                                                                                                                                                                                                                                                                                      
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2522889          1 0.2522889 3.207178   496
## [39] {H16 wtr>2 wks no interest in life=[0,1]|u603,                                                                                                                                                                                                                                                                                           
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2772126          1 0.2772126 3.207178   545
## [40] {H16 wtr>2 wks no interest in life=[0,1]|u603,                                                                                                                                                                                                                                                                                           
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2772126          1 0.2772126 3.207178   545
## [41] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u574,                                                                                                                                                                                                                  
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2772126          1 0.2772126 3.207178   545
## [42] {D41  how close to father=Values range from 1 to 7; 1 represents "Not Close At All" and 7 represents "Very Close"|u574,                                                                                                                                                                                                                  
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2772126          1 0.2772126 3.207178   545
## [43] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                               
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2914547          1 0.2914547 3.207178   573
## [44] {# Days ate: veges 02=Number of days|u211,                                                                                                                                                                                                                                                                                               
##       H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}        => {H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625} 0.2914547          1 0.2914547 3.207178   573
## [45] {Whether sample or nonsample=This individual is born-in sample (ER30002=030-169)|u8,                                                                                                                                                                                                                                                     
##       H23c how often musclebuilding activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u625}  => {H23b how often do light activities=Inap.:  respondent was head or wife/"wife" in 2011 PSID interview (Head-wife status=1 or 2)|u618}       0.2522889          1 0.2522889 3.207178   496
## NULL