stratEst.data: Creates a stratEst.data object.

View source: R/stratEst_data.R

stratEst.dataR Documentation

Creates a stratEst.data object.

Description

Creates a stratEst.data object.

Usage

stratEst.data(
  data,
  choice = "choice",
  input = c("input"),
  input.lag = 0,
  input.sep = "",
  id = "id",
  game = "game",
  period = "period",
  add = NULL,
  drop = NULL
)

Arguments

data

a data.frame in the long format.

choice

a character string. The variable in data which contains the discrete choices. Default is "choice".

input

a character string. The names of the input generating variables in data. At least one input generating variable has to be specified. Default is c("input").

input.lag

a numeric vector. The time lag in periods of the input generating variables. An integer or a vector of integers with as many elements as variables specified in the object input. Default is zero.

input.sep

a character string. Separates the input generating variables. Default is "".

id

a character string. The name of the variable in data that identifies observations of the same individual. Default is "id".

game

a character string. The name of the variable in data that identifies observations of the same game. Default is "game".

period

a character string. The name of the variable in data that identifies the periods of a game. Default is "period".

add

a character vector. The names of variables in the global environment that should be added to the stratEst.data object. Default is NULL.

drop

a character vector. The names of variables in data that should be dropped. Default is NULL.

Details

The data generation function of the package.

Value

A stratEst.data object. A data frame in the long format with the following variables:

id

the variable that identifies observations of the same individual.

game

the variable that identifies observations of the same game.

period

the period of the game.

choice

the discrete choices.

input

the inputs.

Examples

## Transform the prisoner's dilemma data of Dal Bo and Frechette (2011).
data.DF2011 <- stratEst.data(DF2011, choice = "choice",
                             input=c("choice", "other.choice"), input.lag = 1)

## Transform the prisoner's dilemma data of Fudenberg, Rand, and Dreber (2012).
data.FRD2012 <- stratEst.data(data = FRD2012, choice = "choice",
                             input = c("last.choice", "last.other"))

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