gravity | R Documentation |
Computes the dissimilarities using a gravity model based on co-occurrences.
gravity(X, lambda = 1)
X |
numeric matrix |
lambda |
tuning parameter |
The first step in this function is to compute the co-occurences. Based on the
binarized data matrix Y
we compute Y'Y
which leads to the co-occurence matrix.
We then use the gravity model to compute the gravity dissimilarities.
In order to give more (or less) structure to the MDS solution, the tuning parameter (which
defines a power transformation) can be increased (or decreased). In addition,
a weight matrix is created that sets cells with no co-occurences to 0. The corresponding weight matrix for blanking out these cells is established automatically in mds()
.
gravdiss |
Gravity dissimilarities |
weightmat |
Weight matrix for subsequent smacof computation |
co.occ |
Matrix with co-occurences |
Patrick Mair
Mair, P., Rusch, T. & Hornik, K. (2014). The Grand Old Party - A party of values? SpringerPlus, 3(697), https://springerplus.springeropen.com/articles/10.1186/2193-1801-3-697
mds
data(GOPdtm)
gravD <- gravity(GOPdtm, lambda = 2)
res <- mds(gravD$gravdiss)
res$weightmat ## NA's were blanked out when fitting the model
plot(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.