bertrand_calibrate_gnl: Calibrate Bertrand model with GNL demand

View source: R/bertrand_calibrate_gnl.R

bertrand_calibrate_gnlR Documentation

Calibrate Bertrand model with GNL demand

Description

Calibrate Bertrand model with GNL demand

Usage

bertrand_calibrate_gnl(
  param,
  own,
  price,
  shares,
  cost,
  weight = NA,
  nest_allocation,
  div_matrix = NA,
  mu_constraint_matrix = NA,
  div_calc_marginal = TRUE,
  returnOutcomes = FALSE
)

Arguments

param

Vector of demand parameters (alpha,mu)

own

Ownership matrix

price

Observed prices

shares

Observed market shares

cost

Marginal costs for each product

weight

Weighting vector of length equal to number of margins provided; if diversions are provided, these weights are relative to weight on matching diversions.

nest_allocation

For generalized nested logit demand, a J-by-K matrix where each element (j,k) designates the membership of good j in nest k. Rows should sum to 1.

div_matrix

A matrix of observed diversions from product in row j to product in column k.

mu_constraint_matrix

is a (K-by-K') matrix indicating which nesting parameters are constrained to be equal to each other, where K is the number of nests and K' is the number of freely varying nesting parameters. mu_full = mu_constraint_matrix %*% mu_prime. Where mu_full is a vector of length K of the nesting parameter value for each nest, and mu_prime is a vector of length K' of parameters to be calculated. It must be the case that K is greater than K'.

div_calc_marginal

is a logical if function should match to marginal diversions (if TRUE) or second choice diversions (if FALSE). Default to TRUE.

returnOutcomes

logical; should equilibrium objects be returned (mean value parameter, prices, shares, costs) as a list.

Details

This function calibrates a Bertrand model with generalized nested logit (GNL) demand

Value

Difference between model predicted and observed values of prices, shares, and diversions.

Examples

nest1 <- matrix( c(1, 0, 0, 0, 1, 1), ncol = 2, nrow = 3)
divmat <- matrix( c(0, .4, .4, .4, 0, .4, .4, .4, 0), ncol = 3, nrow = 3)

bertrand_calibrate_gnl(param = c(-0.9, 1, 1),
                       own = diag(3),
                       price = c(.05, .34, .33),
                       shares = c( 0.31, 0.27, 0.25),
                       cost = c(.05,.31,.30),
                       weight = c(1,1,1),
                       nest_allocation = nest1, div_matrix = divmat)


mergersim documentation built on July 21, 2026, 5:09 p.m.