knn_tools: helpers for tree list imputation, knn

knn_toolsR Documentation

helpers for tree list imputation, knn

Description

Series of helpers which in combination with the package yaImpute can be used to perform tree-list imputation.

Usage

yai_id(
  xNms = NULL,
  yNms = NULL,
  idNm = NULL,
  data = NULL,
  omity = NULL,
  dup_ids_remove = T,
  ...
)

newtargets_id(yai_mod, idNm, data, k = NULL, ann = NULL)

impute_id(newtargs_id, ...)

yai_weights(
  yaimod,
  dtype = c("invdist", "invdist2", "eq"),
  zero_dist = c("small", "min", "NA")
)

tl_impute(
  wts,
  idNm,
  cols_knn_id = "col_id",
  cols_knn_wt = "col_wt",
  trees,
  sort_targets = F,
  debug = F
)

tl_impute_2(
  wts,
  idNm,
  cols_knn_id = "col_id",
  cols_knn_wt = "col_wt",
  trees,
  debug = F
)

yai_cv(
  omit = 5,
  idNm,
  xNm,
  yNm,
  pdNm = NA,
  data,
  iter_max = 500,
  k = 5,
  debug = FALSE,
  method = "msn",
  min_rows = 15,
  method_impute = c("closest", "mean", "median", "dstWeighted"),
  ...
)

Arguments

idNm

name of id field

data

input data

omity

optional: records to omit

...

other arguments to ??

yai_mod

model returned by yai_id

k

?number of neighbors?

ann

T/Fsee yai documentation



impute_id() parameters:

newtargs_id

?

yaimod

model returned by yai_id

dtype

distance type

wts

weights from ?

cols_knn_id

col names of knn ids

cols_knn_wt

col names of knn wts

debug

T/F

omit

observation to omit at time i

yNm

?names of response fields

iter_max

number of iterations max

method

? distance approach?

id_x

vector of auxiliary variable column names led by id variable

id_y

vector of response variable column names led by id variable

id

id column

zero_dist()

how to deal with zero distances (e.g. when everything is zero)



tl_impute parameters:

env

environment with weights in it

tr_pl

tree records

x

?

max_comb

??

Details

yaImpute has some funkiness (e.g using row names as an ID field... bad...) and cannot support tree list imputation. The functions here facilitate that process

yai_id: Update of yai that replaces row names with record ids newtargets_id: wrapper for newtargets that handles yai_id object impute_id: impute response values to target locations - wrapper for 'impute()' in yaImpute handles id field more explicitly yai_weights: Get weights associated with imputation objects tl_impute: function to impute tree list based on knn model fitted between aerial attributes yai_cv: peform crossvalidation on knn model

This program is free software but it is provided WITHOUT WARRANTY and with ABSOLUTELY NO GUARANTEE of fitness or functionality for any purpose; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.


Revision History

1.0 2014 July 04 Import from Jacob's R Library
1.0 2015 Jan 06 Add roxygen header

Value

yai_id:
newtargets_id:
impute_id:
yai_weights:
tl_impute:
yai_cv:

Author(s)

Jacob Strunk <Jacob.strunk@usgda.gov>

See Also

yaImpute
fit_pdf

Examples


<Delete and Replace>





jstrunk001/RSForInvt documentation built on April 18, 2022, 11:03 p.m.