Description Usage Arguments Value Author(s) References See Also Examples
View source: R/HotDeckImputation.R
A function that performs Vogel's approximation method. A heuristic to reduce the total sum of donor-recipient distances.
1 | match.d_r_vam(distance = NULL, recipients=NULL, donors=NULL, donor_limit=NULL)
|
distance |
A distance matrix of dimensions length(donors) * length(recipients) |
recipients |
A vector of object (row) numbers from the original data matrix, indicating which objects require imputation. |
donors |
A vector of object (row) numbers from the original data matrix, indicating which objects may be used for imputation. |
donor_limit |
A vector of length(donors) detailing how often any one donor may be used. |
A matrix of dimensions length(recipients) * 2. The first column, named recipients, is equivalent to recipients
. The second column, named donors, contains the donor that is matched to any of the recipients.
Dieter William Joenssen Dieter.Joenssen@googlemail.com
Domschke, W. (1995) Logistik: Transport. Munich: Oldenbourg. [in German]
Joenssen, D.W. (2015) Donor Limited Hot Deck Imputation: A Constrained Optimization Problem. In: B. Lausen, S. Krolak-Schwerdt, and M. B\"ohmer (Eds.): Data Science, Learning by Latent Structures, and Knowledge Discovery. Studies in Classification, Data Analysis and Knowledge Organization, pages 319–328. Berlin/Heidelberg: Springer.
Joenssen, D.W. (2015) Hot-Deck-Verfahren zur Imputation fehlender Daten – Auswirkungen des Donor-Limits. Ilmenau: Ilmedia. [in German, Dissertation]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #Set the random seed to an arbitrary number
set.seed(421)
#Set up a random distance matrix
ndonor=20
nrecip=20
distance<-matrix(sample(1:100,replace=TRUE,size=ndonor*nrecip),nrow=ndonor,ncol=nrecip)
#Name donors and recipients
donors<-1:nrow(distance)
recipients<-(nrow(distance)+1):(nrow(distance)+ncol(distance))
colnames(distance)<-recipients
rownames(distance)<-donors
#Set up the donor limit variable
donor_limit<-rep(1,length(donors))
#perform the matching
match.d_r_vam(distance=distance,recipients=recipients,donors=donors,
donor_limit=donor_limit)
|
recipient donor
[1,] 21 19
[2,] 22 6
[3,] 23 1
[4,] 24 15
[5,] 25 11
[6,] 26 14
[7,] 27 4
[8,] 28 7
[9,] 29 18
[10,] 30 16
[11,] 31 12
[12,] 32 8
[13,] 33 20
[14,] 34 2
[15,] 35 13
[16,] 36 17
[17,] 37 5
[18,] 38 10
[19,] 39 3
[20,] 40 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.