knn_nas_imp {creditmodel}R Documentation

Imputate nas using KNN

Description

This function is not intended to be used by end user.

Usage

knn_nas_imp(
  dat,
  x,
  nas_rate = NULL,
  mat_nas_shadow = NULL,
  dt_nas_random = NULL,
  k = 10,
  scale = FALSE,
  method = "median",
  miss_value_num = -1
)

Arguments

dat

A data.frame with independent variables.

x

The name of variable to process.

nas_rate

A list contains nas rate of each variable.

mat_nas_shadow

A shadow matrix of variables which contain nas.

dt_nas_random

A data.frame with random nas imputation.

k

Number of neighbors of each obs which x is missing.

scale

Logical.Standardization of variable.

method

The methods of imputation by knn. "median" is knn imputation with k neighbors median, "avg_dist" is knn imputation with k neighbors of distance weighted mean.

miss_value_num

Default value of missing data imputation for numeric variables, Defualt is -1.


[Package creditmodel version 1.3.1 Index]