dccvResponse: Generate artificial responses to dichotomous choice CV...

View source: R/dccvResponse.R

dccvResponseR Documentation

Generate artificial responses to dichotomous choice CV questions

Description

This function synthesizes responses to DCCV questions.

Usage

dccvResponse(bid, b, n, seed = NULL)

Arguments

bid

a vector (for SBDC) or matrix (for DBDC) containing a bid design

b

a vector containing parameters of independent variables in the model

n

an integer value showing the number of respondents in the resultant dataset

seed

seed for a random number generator

Details

This function synthesizes response to SBDC- or DBDC-CV questions on the basis of the utility difference approach. See Aizaki et al. (2014) for detail on the model.

See the examples below for usage in detail.

Value

This function returns a data frame, in which each row shows a single respondent. It contains the following variables.

For SBDC-CV,

R1

a response to a bid: 1 for "Yes", 0 for "No"

bid1

the bid

For DBDC-CV,

R1

the response in the first stage, which takes 1 for "Yes", 0 for "No"

R2

the response in the second stage, which takes 1 for "Yes", 0 for "No"

bid1

the bid in the first stage

bid2

the bid in the second stage the respondent faced

References

Aizaki H, Nakatani T, Sato K (2014). Stated Preference Methods Using R. CRC Press, Boca Raton, FL.

See Also

sbchoice, dbchoice,

Examples

# SBDC-CV
data(CarsonSB)
CarsonSB
CarsonSB[, 1]
SB <- dccvResponse(bid = CarsonSB[, 1], b = c(0.64, -0.011), n = 1000)
head(SB)
sbchoice(R1 ~ 1|bid1, dist = "logistic", data = SB)

# DBDC-CV
data(CarsonDB)
CarsonDB
CarsonDB[, 1:3]
DB <- dccvResponse(bid = data.matrix(CarsonDB[, 1:3]), b = c(0.7, -0.016), n = 1000)
head(DB)
dbchoice(R1 + R2 ~ 1|bid1 + bid2, dist = "logistic", data = DB)

DCchoice documentation built on July 26, 2023, 6:11 p.m.