prune_c2c {cat2cat}R Documentation

A set of prune methods which will be useful after transition process

Description

user could specify one from four methods to prune replications

Usage

prune_c2c(
  df,
  index = "index_c2c",
  column = "wei_freq_c2c",
  method = "nonzero",
  percent = 50
)

Arguments

df

data.frame

index

character default wei_freq_c2c

column

character default index_c2c

method

character one of four available methods: default "nonzero", "highest", "highest1", "morethan"

percent

integer from 0 to 99

Details

method - specify method to reduce number of replications

Value

data.frame

Examples

data(occup_small)
data(occup)
data(trans)

occup_old <- occup_small[occup_small$year == 2008, ]
occup_new <- occup_small[occup_small$year == 2010, ]

occup_2 <- cat2cat(
  data = list(old = occup_old, new = occup_new, cat_var = "code", time_var = "year"),
  mappings = list(trans = trans, direction = "backward"),
  ml = list(
    method = "knn",
    features = c("age", "sex", "edu", "exp", "parttime", "salary"),
    args = list(k = 10)
  )
)

prune_c2c(occup_2$old, method = "nonzero")
prune_c2c(occup_2$old, method = "highest")
prune_c2c(occup_2$old, method = "highest1")
prune_c2c(occup_2$old, method = "morethan", percent = 90)

prune_c2c(occup_2$old, column = "wei_knn_c2c", method = "nonzero")

[Package cat2cat version 0.2.1 Index]