stratEst.model: Strategy Estimation Function

View source: R/stratEst_model.R

stratEst.modelR Documentation

Strategy Estimation Function

Description

The estimation function of the package.

Usage

stratEst.model(
  data,
  strategies,
  shares = NULL,
  coefficients = NULL,
  covariates = NULL,
  sample.id = NULL,
  response = "mixed",
  sample.specific = c("shares", "probs", "trembles"),
  r.probs = "no",
  r.trembles = "global",
  select = NULL,
  min.strategies = 1,
  crit = "bic",
  se = "analytic",
  outer.runs = 1,
  outer.tol = 1e-10,
  outer.max = 1000,
  inner.runs = 10,
  inner.tol = 1e-05,
  inner.max = 10,
  lcr.runs = 100,
  lcr.tol = 1e-10,
  lcr.max = 1000,
  bs.samples = 1000,
  quantiles = c(0.05, 0.5, 0.95),
  step.size = 1,
  penalty = FALSE,
  verbose = FALSE
)

Arguments

data

a stratEst.data object or data.frame.

strategies

a list of strategies. Each element if the list must be an object of class stratEst.strategy.

shares

a numeric vector of strategy shares. The order of the elements corresponds to the order in strategies. Elements which are NA are estimated from the data. Use a list of numeric vectors if data has more than one sample and shares are sample specific.

coefficients

a matrix of latent class regression coefficients.

covariates

a character vector with the names of the covariates of the latent class regression model in the data. The covariates cannot have missing values.

sample.id

a character string indicating the name of the variable which identifies the samples in data. Individual observations must be nested in samples.

response

a character string which is either "pure" or "mixed". If "pure" the estimated choice probabilities are either zero or one. If "mixed" the estimated choice probabilities are mixed parameters. The default is "mixed".

sample.specific

a character vector, Defines the model parameters that are sample specific. Can contain the character strings "shares" ("probs", "trembles". If the vector contains "shares" ("probs", "trembles"), the estimation function estimates a set of shares (choice probabilities, trembles) for each sample in the data.

r.probs

a character string. Options are "no", "strategies", "states" or "global". Option "no" yields one vector of choice probabilities per strategy and state. Option "strategies" yields one vector of choice probabilities per strategy. Option "states" yields one vector of choice probabilities per state. Option "global" yields a single vector of choice probabilities. Default is "no".

r.trembles

a character string. Options are "no", "strategies", "states" or "global". Option "no" yields one tremble probability per strategy and state. Option "strategies" yields one tremble probability per strategy. Option "states" yields one tremble probability per state. Option "global" yields a single tremble probability. Default is "no".

select

a character vector. Indicates the classes of model parameters that are selected. Can contain the character strings "strategies", ("probs", and "trembles". If the vector contains"strategies" ("probs", "trembles"), the number of strategies (choice probabilities, trembles) is selected based on the selection criterion specified in "crit". The selection can be restricted with the arguments r.probs and r.trembles. Default is NULL.

min.strategies

an integer. The minimum number of strategies in case of strategy selection. The strategy selection procedure stops if the minimum is reached.

crit

a character string. Defines the information criterion used for model selection. Options are "bic" (Bayesian information criterion), "aic" (Akaike information criterion) or "icl" (Integrated Classification Likelihood). Default is "bic".

se

a string. Defines how standard errors are obtained. Options are "analytic" or "bootstrap". Default is "analytic".

outer.runs

an integer. The number of outer runs of the solver. Default is 1.

outer.tol

a number close to zero. The tolerance of the stopping condition of the outer runs. The iterative algorithm stops if the relative decrease of the log likelihood is smaller than this number. Default is 1e-10.

outer.max

an integer. The maximum number of iterations of the outer runs of the solver. The iterative algorithm stops after "outer.max" iterations if it does not converge. Default is 1000.

inner.runs

an integer. The number of inner runs of the solver. Default is 10.

inner.tol

a number close to zero. The tolerance of the stopping condition of the inner runs. The iterative algorithm stops if the relative decrease of the log likelihood is smaller than this number. Default is 1e-5.

inner.max

an integer. The maximum number of iterations of the outer runs of the solver. The iterative algorithm stops after "inner.max" iterations if it does not converge. Default is 10.

lcr.runs

an integer. The number of latent class regression runs of the solver. Default is 100.

lcr.tol

a number close to zero. The tolerance of the stopping condition of the latent class regression runs. The iterative algorithm stops if the relative decrease of the log likelihood is smaller than this number. Default is 1e-10.

lcr.max

an integer. The maximum number of iterations of the latent class regression runs of the solver. The iterative algorithm stops after "lcr.max" iterations if it does not converge. Default is 1000.

bs.samples

an integer. The number of bootstrap samples.

quantiles

a numeric vector. The quantiles of the sampling distribution of the estimated parameters. Depending on the option of se, the quantiles are either estimated based on a t-distribution with res.degrees of freedom and the analytic standard errors or based the bootstrap.

step.size

a number between zero and one. The step size of the Fisher scoring step which updates the coefficients. Values smaller than one slow down the convergence of the algorithm and prevent overshooting. Default is one.

penalty

a logical. If TRUE the Firth penalty is used to estimate the coefficients of the latent class regression model. Default is FALSE.

verbose

a logical. If TRUE information about the estimation process are printed to the console. Default is FALSE.

Details

The estimation function of the package obtains maximum likelihood estimates for the model parameters based on expectation maximization and Newton-Raphson algorithms.

Value

An object of class stratEst.model. A list with the following elements.

strategies

the fitted strategies.

shares

the strategy shares.

probs

the choice probabilities of the strategies.

trembles

the tremble probabilities of the strategies.

gammas

the gamma parameters of the strategies.

coefficients

the coefficients of the covariates.

shares.par

the estimated strategy share parameters.

probs.par

the estimated choice probability parameters.

trembles.par

the estimated tremble parameters.

gammas.par

the estimated gamma parameters.

coefficients.par

the estimated coefficient parameters of the covariates.

shares.indices

the parameter indices of the strategy shares.

probs.indices

the parameter indices of the choice probabilities.

trembles.indices

the parameter indices of the tremble probabilities.

coefficients.indices

the parameter indices of the coefficients.

loglike

the log likelihood of the model.

num.ids

the number of individuals.

num.obs

the number of observations.

num.par

the total number of model parameters.

free.par

the number of free model parameters.

res.degrees

the residual degrees of freedom.

aic

the Akaike information criterion.

bic

the Bayesian information criterion.

icl

The integrated classification likelihood.

crit.val

the value of the selection criterion defined by the argument crit.

eval

the total number of iterations of the solver.

tol.val

the relative decrease of the log likelihood in the last iteration of the algorithm.

convergence

the maximum of the absolute scores of the estimated model parameters.

entropy.model

the entropy of the model.

entropy.assignments

the entropy of the posterior probability assignments of individuals to strategies.

chi.global

the chi square statistic for global model fit.

chi.local

the chi square statistics for local model fit.

state.obs

the weighted observations for each strategy state.

post.assignments

the posterior probability assignments of individuals to strategies.

prior.assignments

the prior probability of each individual to use a strategy as predicted by the individual covariates.

shares.se

the standard errors of the estimated share parameters.

probs.se

the standard errors of the estimated choice probability parameters.

trembles.se

the standard errors of the estimated tremble probability parameters.

gammas.se

the standard errors of the estimated gamma parameters.

coefficients.se

the standard errors of the estimated coefficients.

shares.quantiles

the quantiles of the estimated population shares.

probs.quantiles

the quantiles of the estimated choice probabilities.

trembles.quantiles

the quantiles of the estimated trembles.

coefficients.quantiles

the quantiles of the estimated coefficients.

shares.score

the scores of the estimated share parameters.

probs.score

the score of the estimated choice probabilities.

trembles.score

the score of the estimated tremble probabilities.

coefficients.score

the score of the estimated coefficient.

shares.fisher

the Fisher information matrix of the estimated shares.

probs.fisher

the Fisher information matrix of the estimated choice probabilities.

trembles.fisher

the Fisher information matrix of the estimated trembles.

coefficients.fisher

the fisher information matrix of the estimated coefficients.

fit.args

the input objects of the function call.

Note

Strategy estimation was introduced by Dal Bo and Frechette (2011) to estimate the maximum likelihood frequencies of a set of candidate strategies in the repeated prisoner's dilemma. Breitmoser (2015) introduces model parameters for the choice probabilities of individual strategies to the strategy estimation model. Dvorak and Fehrler (2018) extend the basic strategy estimation model by individual level covariates to explain the selection of strategies by individuals. The estimation function of the package obtains maximum likelihood estimates for the model parameters based on expectation maximization (Dempster, Laird, and Rubin, 1977) and Newton-Raphson algorithms. To decrease the computation time, the package integrates C++ and R with the help of the R packages Rcpp (Eddelbuettel and Francois, 2011) and the open source linear algebra library for the C++ language RppArmadillo (Sanderson and Curtin, 2016).

References

Breitmoser Y (2015). "Cooperation, but no Reciprocity: Individual Strategies in the Repeated Prisoner’s Dilemma." American Economic Review, 105(9), 2882-2910.

Dal Bo P, Frechette GR (2011). "The Evolution of Cooperation in Infinitely Repeated Games: Experimental Evidence." American Economic Review, 101(1), 411-429.

Dempster A, Laird N, Rubin DB (1977). "Maximum Likelihood from Incomplete Data via the EM Algorithm." Journal of the Royal Statistical Society Series B, 39(1), 1-38.

Dvorak F, Fehrler S (2018). "Negotiating Cooperation under Uncertainty: Communication in Noisy, Indefinitely Repeated Interactions." IZA Working Paper, No. 11897.

Dvorak F, Fischbacher U, Schmelz K (2020). "Incentives for Conformity and Anticonformity." TWI Working Paper Series.

Eddelbuettel D, Francois R (2011). "Rcpp: Seamless R and C++ Integration." Journal of Statistical Software, 40(8), 1-18.

Fudenberg D, Rand DG, Dreber A (2012). "Slow to Anger and Fast to Forgive: Cooperation in an Uncertain World." American Economic Review, 102(2), 720-749.

Sanderson C, Curtin R (2016). "Armadillo: A Template-Based C++ Library for Linear Algebra." Journal of Open Source Software, 1, 26.

Wang Z, Xu B, Zhou HJ (2014). "Social Cycling and Conditional Responses in the Rock-Paper-Scissors Game." Scientific Reports, 4(1), 2045-2322.

Examples

## Strategy model for rock-paper-scissors data of Wang, Xu, and Zhou (2014).
## Fit a mixture of the Nash strategy and a strategy that imitates the last choice.
strategies.mixture = list("nash" = strategies.RPS$nash, "imitate" = strategies.RPS$imitate)
model.mixture <- stratEst.model(data.WXZ2014,strategies.mixture)


stratEst documentation built on Dec. 1, 2022, 1:13 a.m.