flimobjective: Objective function minimized by flimo

View source: R/functions.R

flimobjectiveR Documentation

Objective function minimized by flimo

Description

Computes the summary statistics between simulations w.r.t. Theta and data. This function is to be minimized by flimoptim.

Usage

flimobjective(Theta, quantiles, data, dsumstats, simulatorQ)

Arguments

Theta

1D array. parameters for the simulations.

quantiles

2D array containing values drawn in U(0,1). Row number = number of simulations. Column number = number of random variables to draw in one simulation.

data

1D array containing the observations.

dsumstats

Function computing the distance between simulations and data of form dsumstats(simulations, data) where simulations : 2D array and data : 1D array. ncol(simulations) = length(data) mandatory.

simulatorQ

Function of type simulatorQ(Theta, quantiles) where Theta is the parameter set for the simulations and quantiles are drawn in U(0,1). See README for details.

Value

Numeric value. Distance between summary statistics of data and simulations w.r.t. Theta.

Examples


quantiles <- matrix(runif(50), nrow = 10)

data <- rep(100, 5)

dsumstats <- function(simulations, data){
mean_simu <- mean(rowMeans(simulations))
mean_data <- mean(data)
(mean_simu-mean_data)^2
}

simulatorQ <- function(Theta, quantiles){
qpois(quantiles, lambda = Theta)
}

flimobjective(100, quantiles, data, dsumstats, simulatorQ)


flimo documentation built on May 31, 2023, 6:04 p.m.