generate_spatial {voteSim}R Documentation

Generate spatial simulation

Description

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.

Usage

generate_spatial(
  n_voters,
  n_candidates,
  placement = "uniform",
  score_method = "linear",
  dim = 2
)

Arguments

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)

Value

A matrix of scores.

Examples

generate_spatial(n_candidates = 5,n_voters = 100,  placement = "uniform", score_method = "linear")

[Package voteSim version 0.1.1 Index]