mdcev.data: data.frame for mdcev model

View source: R/mdcev.data.R

mdcev.dataR Documentation

data.frame for mdcev model

Description

shape a 'data.frame' in a suitable form for the use of the 'mdcev' function and complete some data checks

Usage

mdcev.data(
  data,
  id.var = "id",
  alt.var = NULL,
  choice = "choice",
  price = "price",
  income = "income",
  alt.levels = NULL,
  drop.index = FALSE,
  subset = NULL,
  ...
)

Arguments

data

a 'data.frame',

id.var

the name of the variable that contains the individual index.

alt.var

the name of the variable that contains the alternative index or the name under which the alternative index will be stored (the default name is 'alt'),

choice

the variable indicating the consumption of non-numeraire alternatives that is made: it has to be a numerical vector. Default is "choice".

price

the variable indicating the price of the non-numeraire alternatives. Default is "price"

income

the variable indicating the income of the individual. Default is "income".

alt.levels

the name of the alternatives: if null, they are guessed from the 'alt.var' argument,

drop.index

should the index variables be dropped from the 'data.frame',

subset

a logical expression which defines the subset of observations to be selected,

...

further arguments.

Value

A 'mdcev.data' object, which is a 'data.frame' in long format, *i.e.* one line for each alternative. It has a 'index' attribute, which is a 'data.frame' that contains the index of the individual ('id') and the index of the alternative ('alt').


rmdcev documentation built on March 31, 2023, 6:49 p.m.