Description Usage Arguments Details Value Note References

Performs variants of the strategy estimation method.

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
)
``` |

`data` |
A |

`strategies` |
A list of strategies. Each strategy is a data.frame of class |

`shares` |
A vector of strategy shares. The elements to the order of strategies in the list |

`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 |

`sample.specific` |
A character vector defining which model parameters are sample specific. If the vector contains the character |

`r.probs` |
A string which can be set to |

`r.trembles` |
A string which can be set to |

`select` |
A character vector indicating which model parameters are selected. If the vector contains the character |

`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 |

`se` |
A string which can be set to |

`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.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 |

`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.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 |

`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.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 |

`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 |

`verbose` |
A logical, if |

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.

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 |

`probs` |
Matrix of choice probabilities. The value |

`trembles` |
Matrix of tremble probabilities of the strategies. The value |

`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 |

`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 |

`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. |

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).

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.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.