# stratEst: Strategy Estimation Function In stratEst: Strategy Estimation

## Description

Performs variants of the strategy estimation method.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30``` ```stratEst( data, strategies, shares, coefficients, covariates, sample.id, 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.01, 0.05, 0.5, 0.95, 0.99), stepsize = 1, penalty = F, verbose = TRUE ) ```

## Arguments

 `data` A `stratEst.data` object or `data.frame`. Must contain the variables `choice`, `input`, `id`, `game`, `period`. The variable `id` identifies observations of the same individual across games and periods. The factor `input` indicates the discrete information observed by the individual before making a choice. The factor `choice` indicates the choice of the individual. `strategies` A list of strategies. Each strategy is a data.frame of class `stratEst.strategy`. Each row of the data.frame represents one state of the strategy. The first row defines the initial state which is entered if the variable input is NA. Column names which start with the string 'output.' indicate the columns which contain the multinomial choice probabilities of the strategy. For example, a column labeled 'output.x' contains the probability to observe the output 'x'. The column 'tremble' contains a tremble probability for pure strategies. Column names which start with the string 'input.' indicate the columns which contain the deterministic state transition of the strategy. For example, a column with name 'input.x' indicates the state transition after observing input 'x'. `shares` A vector of strategy shares. The elements to the order of strategies in the list `strategies`. Shares which are `NA` are estimated from the data. With more than one sample and sample specific shares, a list of column vectors is required. `coefficients` Column vector which contains the latent class regression coefficients. The elements correspond to the vector of estimates. `covariates` A character vector indicating the names of the variables in data that are the covariates of the latent class regression model. Rows with the same id must have the values of covariates. Missing value are not allowed. `sample.id` A character indicating the name of the variable which identifies the samples. Individual observations must be nested in samples. The same must be true for clusters if specified. If more than one sample exists, shares are estimated for each sample. All other parameters are estimated for the data of all samples. If the object is not supplied, it is assumed that the data contains only one sample. `response` A string which can be set to `"pure"` or `"mixed"`. If set to `"pure"` all estimated choice probabilities are pure, i.e. either zero or one. If set to `"mixed"` all estimated choice probabilities are mixed. The default is `"mixed"`. `sample.specific` A character vector defining which model parameters are sample specific. If the vector contains the character `"shares"` (`"probs"`, `"trembles"`), the estimation function estimates a set of shares (choice probabilities, trembles) for each sample in the data. If the vector does not contains the character `"shares"` (`"probs"`, `"trembles"`) one set of shares (choice probabilities, trembles) is estimated for the pooled data of all samples. Default is `c("shares","probs","trembles")`. `r.probs` A string which can be set to `"no"`, `"strategies"`, `"states"` or `"global"`. If set to `"strategies"`, the estimation function estimates strategies with one strategy specific vector of choice probabilities in every state of the strategy. If set to `"states"`, one state specific vector of choice probabilities is estimated for each state. If set to `"global"`, a single vector of probabilities is estimated which applies in every state of each strategy. Default is `"no"`. `r.trembles` A string which can be set to `"no"`, `"strategies"`, `"states"` or `"global"`. If set to `"strategies"`, the estimation unction estimates strategies with one strategy specific tremble probability. If set to `"states"`, one state specific tremble probability is estimated for each state. If set to `"global"`, a single tremble probability is estimated which globally. Default is `"global"`. `select` A character vector indicating which model parameters are selected. If the vector contains the character `"strategies"` (`"probs"`, `"trembles"`), the number of strategies (choice probabilities, trembles) is selected based on the selection criterion specified in `"crit"`. The selection of choice probabilities and trembles occurs obeying the restriction specified in `r.probs` and `r.trembles`. (E.g. if `r.probs` is set to `"strategies"`, `select = "probs"` will select the sets of choice probabilities within each strategy). Default is `NULL`. `min.strategies` An integer which specifies the minimum number of strategies in case of strategy selection. The strategy selection procedure stops if the minimum is reached. `crit` A string which can be set to `"bic"`, `"aic"` or `"icl"`. If set to `"bic"`, model selection based on the Bayesian Information criterion is performed. If set to `"aic"`, the Akaike Information criterion is used. If set to `"icl"` the Integrated Classification Likelihood criterion is used. Default is `"bic"`. `se` A string which can be set to `"analytic"` or `"bootstrap"`. If set to `"bootstrap"`, bootstrapped standard errors are reported. Default is `"analytic"`. `outer.runs` A positive integer which stets the number of outer runs of the solver. Default is 1. `outer.tol` A positive number which stets the tolerance of the continuation condition of the outer runs. The iterative algorithm stops if the relative decrease of the log-likelihood is smaller than `outer.tol`. Default is 0. `outer.max` A positive integer which stets the maximum number of iterations of the outer runs of the solver. The iterative algorithm stops if it did not converge after `"outer.max"` iterations. Default is 1000. `inner.runs` A positive integer which stets the number of inner runs of the solver. Default is 10. `inner.tol` A positive number which stets the tolerance of the continuation condition of the inner EM runs. The iterative algorithm stops if the relative decrease of the log-likelihood is smaller than `inner.tol`. Default is 0. `inner.max` A positive integer which stets the maximum number of iterations of the inner EM runs. The iterative algorithm stops if it did not converge after `inner.max` iterations. Default is 10. `lcr.runs` A positive integer which stets the number of estimation runs for latent class regression. Default is 100. `lcr.tol` A positive number which stets the tolerance of the continuation condition of the Latent Class Regression runs. The iterative algorithm stops if the relative decrease of the log-likelihood is smaller than `lcr.tol`. Default is 0. `lcr.max` A positive integer which stets the maximum number of iterations of the Latent Class Regression EM runs. The iterative algorithm stops if it did not converge after `lcr.max` iterations. Default is 1000. `bs.samples` A positive integer which sets the number of bootstrap samples drawn with replacement. `quantiles` A numeric vector indicating the quantiles of the sampling distribution of the estimated parameters. The quantiles are identified based on the standard error or based on bootstrapping the sampling distribution of the parameter. `stepsize` A positive number which sets the stepsize of the Fisher scoring algorithm used to estimate the coefficients of the latent class regression model. Default is one. Values smaller than one slow down the convergence of the algorithm. `penalty` A logical indicating if the Firth penalty is used to estimate the coefficients of the latent class regression model. Default is `FALSE`. Irrespective of the value specified here, the penalty is used in the case of a bootstrap of the standard errors of latent class regression coefficients. `verbose` A logical, if `TRUE` messages of the estimation process and a summary of the estimated model is printed to the console. Default is `TRUE`.

## Details

The estimation function `stratEst()` returns maximum-likelihood estimates for the population shares and choice probabilities of a set of candidate strategies given some data from an economic experiment. Candidate strategies can be supplied by the user in the form of deterministic finite-state automata. The number and the complexity of strategies can be restricted by the user or selected based on information criteria. stratEst also features latent class regression to assess the influence of covariates on strategy choice.

## Value

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

 `strategies` A list of fitted strategies. `shares` Matrix of strategy shares. The order of rows corresponds to the order of strategies defined in the input object `strategies`. `probs` Matrix of choice probabilities. The value `NA` indicates that the probability could not be estimated since data does not contain observations the model assigns to the corresponding state. `trembles` Matrix of tremble probabilities of the strategies. The value `NA` indicates that the corresponding probability could not be estimated since data does not contain observations the model assigns to the corresponding state. `coefficients` Matrix of latent class regression coefficients for strategies. `shares.par` Estimated strategy shares. `probs.par` Estimated choice probabilities. `trembles.par` Estimated tremble probabilities. `coefficients.par` Estimated latent class regression coefficients. `shares.indices` Indices of strategy shares. `probs.indices` Indices of choice probabilities. `trembles.indices` Indices of tremble probabilities. `coefficients.indices` Indices of latent class regression coefficients. `loglike` The log-likelihood of the model. Larger values indicate a better fit of the model to the data. `crit.val` The value of the selection criterion defined under `crit`. Larger values indicate a better fit of the model. `eval` Number of iterations of the solver. The reported number is the sum of iterations performed in the inner and the outer run which produced the reported estimates. `tol.val` The relative decrease of the log-likelihood in the last iteration of the algorithm. `convergence` Maximum absolute score of the model parameters. Small values indicate convergence of the algorithm to a (local) maximum of the negative log likelihood. `entropy` Entropy of the posterior probability assignments of individuals to strategies. `state.obs` A column vector with the number of weighted observations for each strategy state corresponding to the rows of `strategies`. `posterior.assignments` Posterior probability of each individual to use a strategy. `prior.assignments` Prior probability of each individual to use a strategy as predicted by the individual covariates. `shares.se` Standard errors of the estimated shares. `probs.se` Standard errors of the estimated choice probabilities. `trembles.se` Standard errors of the estimated trembles. `coefficients.se` Standard errors of the estimated coefficients. `shares.score` Score of the estimated shares. `probs.score` Score of the reported choice probabilities. `trembles.score` Score of the reported trembles. `coefficients.score` Score of the reported coefficients. `shares.fisher` Fisher information of the estimated shares. `probs.fisher` Fisher information of the reported choice probabilities. `trembles.fisher` Fisher information of the reported trembles. `coefficients.fisher` Fisher information of the reported coefficients. `num.obs` Number of observations. `num.ids` Number of individuals. `num.par` Total number of model parameters. `free.par` Total number of free model parameters. `res.degrees` Residual degrees of freedom (num.ids - free.par). `shares.quantiles` Quantiles of the estimated shares. `probs.quantiles` Quantiles of the estimated choice probabilities. `trembles.quantiles` Quantiles of the estimated tremble probabilities. `coefficients.quantiles` Quantiles of the estimated latent class regression coefficients. `gammas` Gamma parameter of the model. `gammas.par` Estimated gamma parameters. `gammas.se` Standard errors of the gamma parameters.

#

 `aic` Akaike information criterion. `bic` Bayesian information criterion. `icl` Integrated classification likelihood information criteria.

## Note

The strategy estimation method was introduced by (Dal Bo & Frechette 2011) to estimate the relative frequency of a fixed set of pure strategies in the indefinitely repeated prisoner's dilemma. Breitmoser (2015) extended the method to the estimation of behavior strategies. The stratEst package uses the EM algorithm (Dempster, Laird & Rubin 1977) and the Newton-Raphson method to obtain maximum-likelihood estimates for the population shares and choice probabilities of a set of candidate strategies. The package builds on other software contributions of the R community. To increase speed the estimation procedures, the package uses integration of C++ and R achieved by the Rcpp package (Eddelbuettel & Francois 2011) and the open source linear algebra library for the C++ language RppArmadillo (Sanderson & Curtin 2016).

## References

Breitmoser, Y. (2015): Cooperation, but no reciprocity: Individual strategies in the repeated prisoner's dilemma, American Economic Review, 105, 2882-2910.

Dal Bo, P. and G. R. Frechette (2011): The evolution of cooperation in infinitely repeated games: Experimental evidence, American Economic Review, 101, 411-429.

Dempster, A., N. Laird, and D. B. Rubin (1977): Maximum likelihood from incomplete data via the EM algorithm," Journal of the Royal Statistical Society Series B, 39, 1-38.

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

Sanderson, C. and R. Curtin (2016): Armadillo: a template-based C++ library for linear algebra. Journal of Open Source Software, 1-26.

stratEst documentation built on July 8, 2020, 7:16 p.m.