View source: R/simulate_weights.R
sim_weights | R Documentation |
Simulation of weights employing the Dirichlet distribution. The concentration parameters for the Dirichlet distribution are tentative weights.
sim_weights(n, utilities, alpha)
n |
number of simulations |
utilities |
utility dataframe, first column is the identifier |
alpha |
concentration parameter for the Dirichlet distribution |
Taking advantage of the Dirichlet distribution properties, the weights could be simulated with a concentration around given weights.
List with data.frames {simulation, weights} with total utilities and simulated weights
Pedro Guarderas pedro.felipe.guarderas@gmail.com
eval_utilities
library( data.table )
N <- 10
utilities <- data.table( id = 1:N,
u1 = runif( N, 0, 1 ),
u2 = runif( N, 0, 1 ),
u3 = runif( N, 0, 1 ),
u4 = runif( N, 0, 1 ) )
n <- 100
alpha <- c( 0.2, 0.5, 0.1, 0.2 )
S <- sim_weights( n, utilities, alpha )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.