File: matchImpute.Rd

package info (click to toggle)
r-cran-vim 6.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,556 kB
  • sloc: cpp: 141; sh: 12; makefile: 2
file content (68 lines) | stat: -rw-r--r-- 1,800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matchImpute.R
\name{matchImpute}
\alias{matchImpute}
\title{Fast matching/imputation based on categorical variable}
\usage{
matchImpute(
  data,
  variable = colnames(data)[!colnames(data) \%in\% match_var],
  match_var,
  imp_var = TRUE,
  imp_suffix = "imp"
)
}
\arguments{
\item{data}{data.frame, data.table or matrix}

\item{variable}{variables to be imputed}

\item{match_var}{variables used for matching}

\item{imp_var}{TRUE/FALSE if a TRUE/FALSE variables for each imputed
variable should be created show the imputation status}

\item{imp_suffix}{suffix for the TRUE/FALSE variables showing the imputation
status}
}
\value{
the imputed data set.
}
\description{
Suitable donors are searched based on matching of the categorical variables.
The variables are dropped in reversed order, so that the last element of
'match_var' is dropped first and the first element of the vector is dropped last.
}
\details{
The method works by sampling values from the suitable donors.
}
\examples{

data(sleep,package="VIM")
imp_data <- matchImpute(sleep,variable=c("NonD","Dream","Sleep","Span","Gest"),
  match_var=c("Exp","Danger"))

data(testdata,package="VIM")
imp_testdata1 <- matchImpute(testdata$wna,match_var=c("c1","c2","b1","b2"))

dt <- data.table::data.table(testdata$wna)
imp_testdata2 <- matchImpute(dt,match_var=c("c1","c2","b1","b2"))
}
\seealso{
\code{\link[=hotdeck]{hotdeck()}}

Other imputation methods: 
\code{\link{hotdeck}()},
\code{\link{impPCA}()},
\code{\link{irmi}()},
\code{\link{kNN}()},
\code{\link{medianSamp}()},
\code{\link{rangerImpute}()},
\code{\link{regressionImp}()},
\code{\link{sampleCat}()}
}
\author{
Johannes Gussenbauer, Alexander Kowarik
}
\concept{imputation methods}
\keyword{manip}