generate_spatial | R Documentation |
This function generates spatial data consisting of n_voters
voters and n_candidates
candidates. The spatial model is created by placing the candidates on a 2-dimensional plane according to the placement
parameter, and then computing a distance matrix between voters and candidates. The distances are then transformed into scores using the score_method
parameter. Finally, a plot of the candidates and voters is produced.
generate_spatial(
n_voters,
n_candidates,
placement = "uniform",
score_method = "linear",
dim = 2
)
n_voters |
The number of voters. |
n_candidates |
The number of candidates. |
placement |
The method used to place the candidates on the 2-dimensional plane. Must be either "uniform" or "beta". Default is "uniform". |
score_method |
The method used to transform distances into scores. Must be either "linear" or "sigmoide". Default is "linear". |
dim |
The dimension of the latent space (by default dim =2) |
A matrix of scores.
generate_spatial(n_candidates = 5,n_voters = 100, placement = "uniform", score_method = "linear")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.