spike-models | R Documentation |
These functions implement a simple spike model analysis of single-, one-and-one-half-, and double-bounded dichotomous choice contingent valuation data using the maximum likelihood method.
## for the single-bounded data
sbspike(formula, data, subset, na.action = na.omit, par = NULL, ...)
## for the one-and-one-half-bounded data
oohbspike(formula, data, subset, na.action = na.omit, par = NULL, ...)
## for the double-bounded data
dbspike(formula, data, subset, na.action = na.omit, par = NULL, ...)
## S3 method for class 'spike'
print(x, digits = max(3, getOption("digits") - 1), ...)
## S3 method for class 'spike'
summary(object, ...)
## S3 method for class 'summary.spike'
print(x, digits = max(3, getOption("digits") - 1), ...)
## S3 method for class 'spike'
logLik(object, ...)
## S3 method for class 'spike'
vcov(object, ...)
## S3 method for class 'spike'
plot(x, type = "l", main = NULL, sub = NULL,
xlab = "Bid", ylab = "Probability", lwd = 3, lty = 1,
xlim = c(0, max(x$bid)), ylim = c(0, 1), bid = c(0, max(x$bid)), ...)
formula |
an object of S3 class |
data |
a data frame containing the variables in the model formula. |
subset |
an optional vector specifying a subset of observations. |
na.action |
a function which indicates what should happen when the data contains |
par |
a vector of initial parameters over which the optimization is carried out. |
x, object |
an object of class |
digits |
the number of digits to display. |
type |
type of plot. |
main |
the main title of the plot. If unspecified, no main title is displayed. |
sub |
the sub-title of the plot. If unspecified, no sub-title is displayed. |
xlab |
the x label of the plot. The default is |
ylab |
the y label of the plot. The default is |
lwd |
the line width for the plot. The default is |
lty |
the line type for the plot. The default is |
xlim |
the x limits of the plot. The default is |
ylim |
the y limits of the plot. The default is |
bid |
the bid limits that should be drawn. The default is |
... |
optional arguments. |
The functions sbspike
, oohbspike
, and dbspike
implement a spike model analysis of single-, one-and-one-half-, and double-bounded dichotomous choice contingent valuation (SB, OOHB, and DB DCCV) data, respectively. A simple spike model assumes a non-zero probability of zero willingness to pay (WTP) for a good/service and a zero probability of negative WTP. These functions are developed according to the original simplest spike model proposed by Kristr\"om (1997) and its follow-up studies (i.e., Yoo and Kwak (2002) for DB DCCV and Kwak et al. (2013) for OOHB DCCV). These functions use a maximum likelihood methods to fit the models with the CV data.
Since the usage of spike model functions sbspike
, oohbspike
, and dbspike
are similar to the un-spike (the ordinary) DCCV model functions sbchoice
, oohbchoice
, and dbchoice
, respectively, this help below explains only the differences in usage between the spike and ordinary model functions. We assume that you understand how to use the ordinary model functions sbchoice
, oohbchoice
, and dbchoice
. If you are unfamiliar with the ordinary model functions, please refer to helps for these at first.
The first difference between the spike and ordinal model functions is that an argument distribution
used in the ordinary model functions is not defined in the spike functions: the functions for spike models assume that the error distribution is only a logistic with a spike, and thus the other distributions (i.e., log-logistic, normal, log-normal, and Weibull) are not available to the spike model functions.
The other difference is about an argument formula
, which is assigned an object of the S3 class 'Formula'
. For a model formula for the ordinary model functions, the left-handed side of the tilde (~
) contains only response variable(s) (i.e., the response to SB DCCV question, R1
, for sbchoice
; the response to the first stage of OOHB/DB DCCV question, R1
, and the second one, R2
, for oohbchoice
and dbchoice
), while it contains both the response variable(s) and spike variable for the spike model functions. The spike variable, S
, which must be set in the second part (after the vertical bar [|
]) of the left-handed side of the tilde, takes the value of 1
if the respondent has a positive WTP for a good specified in the DCCV question and 0
otherwise. See Kristr\"om (1997) for a question to measure whether the respondent has a positive WTP or not. A typical structure of the formula for spike model functions consists of the following four parts:
for sbspike()
,
R1 | S ~ <the names of the covariates> | BD1
for dbspike()
,
R1 + R2 | S ~ <the names of the covariates> | BD1 + BD2
and for oohbspike()
,
R1 + R2 | S ~ <the names of the covariates> | BL + BH
where BD1
and BD2
are variables containing suggested prices in the first and second stages of the SB/DB DCCV question; and BL
and BH
are variables containing suggested lower and higher prices in the OOHB DCCV question.
According to the structure of the formula, a data set (data frame) consists of four parts. An example of the data set for dbspike
is as follows (sex
, age
, and income
are respondent characteristics and assumed to be covariates):
R1 | R2 | S | sex | age | income | BD1 | BD2 |
Yes | Yes | 1 | Male | 20 | Low | 100 | 250 |
Yes | No | 0 | Male | 30 | Low | 500 | 1000 |
... |
The spike model functions fit the models with DCCV data using the function optim
on the basis of the initial coefficients estimated from an un-spike (ordinary) binary logit model analysis of the response to the SB DCCV question, or the first-stage response to the OOHB/DB DCCV question. The binary logit model is estimated internally using the function glm
with the argument family = binomial(link = "logit")
.
The spike model functions return an S3 'spike'
class object. Various methods for the S3 "spike"
class object are provided as follows: print()
displays estimated coefficients; summary()
extracts detailed information on the fitted model; summary.print()
displays information extracted by summary()
; logLik()
extracts the value of a log-likelihood function at estimates; vcov()
returns the variance-covariance matrix of the fitted model; and plot()
draws an estimated survival distribution of the WTP according to the fitted model. These S3 methods correspond to those for the ordinary DCCV functions sbchoice
, oohbchoice
, and dbchoice
. Therefore, for details, see helps for the corresponding methods for ordinary DCCV functions. Note that the mean and median WTPs calculated by summary()
for the spike model functions are defined as follows (see Kristr\"om 1997): mean WTP = ln(1 + exp(A))/B if the parameter for a bid variable (B) is positive (A is the constant), and NA otherwise; median WTP = A/B if 1/(1 + exp(-A)) < 0.5, and 0 otherwise. When covariates are included in the fitted model, the constant in the mean and median WTPs is replaced with x'b, where x is a row vector of covariates at the sample mean including the value of 1 for the constant, and b is a column vector of estimates for covariates including the constant. See Yoo and Kwak (2009), Kwak et al. (2013), and Lee et al. (2010) for SB, OOHB, and DB spike models with covariates, respectively.
The existing functions bootCI
and krCI
, which compute the confidence intervals for the estimates of WTPs using non-parametric and parametric bootstrapping approaches respectively, were revised to handle an S3 'spike'
class object. An existing function ct2df
was also updated to handle a data set in contingency-table format for spike model functions.
Furthermore, a new function spikeCoef
was developed to estimate a spike for the fitted model as 1/(1 + exp(A)), where A is the constant. This function returns the estimated spike, its standard error, and the corresponding z- and p-values under the null hypothesis where the spike is zero. The standard error is calculated using the delta method. When covariates are included in the fitted model, the constant in the formula is replaced with x'b as the mean and median WTP calculations. See the examples below, for details.
These spike model functions return an S3 class object 'spike'
, which is a list with the following components.
f.stage |
a list of components returned from the un-spike (ordinary) binary logit mode analysis using the function |
optim.out |
a list of components returned from the function |
coefficients |
a named vector of estimated coefficients. |
call |
the matched call. |
formula |
the formula supplied. |
Hessian |
an estimate of the Hessian. See also Hessian in |
loglik |
a value of the log likelihood at the estimates. |
convergence |
a logical code: |
niter |
a vector of two integers describing the number of calls to the object function and numerical gradient, respectively. See also counts in |
nobs |
a number of observations. |
covariates |
a named matrix of the covariates used in the model. |
bid |
a named matrix of the bids used in the model. |
yn |
a named matrix of the responses to the SB DCCV question or the first and second stage of the OOHB/DB DCCV question used in the model. |
data.name |
the data matrix. |
terms |
terms. |
contrast |
contrasts used for factors. |
xlevels |
levels used for factors. |
Kristr\"om B. (1997) Spike models in contingent valuation. American Journal of Agricultural Economics 79: 1013–1023.
Yoo S-H, Kwak S-J. (2002) Using a spike model to deal with zero response data from double bounded dichotomous choice contingent valuation surveys. Applied Economics Letters 9: 929–932.
Kwak S-J, Yoo S-H, Kim C-S. (2013) Measuring the willingness to pay for tap water quality improvements: results of a contingent valuation survey in Pusan. Water 5: 1638–1652.
Lee J-S, Yoo S-H, Kwak S-J. (2010) Public's willingness to pay for preventing climate change. Applied Economics Letters 17: 619–622.
Yoo S-H, Kwak S-Y. (2009) Willingness to pay for green electricity in Korea: a contingent valuation study. Energy Policy 37: 5408–5416.
sbchoice
, oohbchoice
, dbchoice
,
ct2df
, krCI
, bootCI
,
CarsonSB
, CarsonDB
, oohbsyn
,
glm
, optim
,
Formula
# Example datasets were created by modifying CarsonSB, CarsonDB, and oohbsyn.
# Spike SB Example
sb <- data.frame(
bid = c(10, 30, 60, 120),
y = c(178, 138, 129, 88),
ny = c(56, 45, 50, 76),
nn = c(30, 84, 76, 93))
SB <- ct2df(sb, bid1 = "bid", type = "single", spike = TRUE)
head(SB)
dim(SB)
SBout <- sbspike(R1 | S ~ 1 | bid1, data = SB)
summary(SBout)
spikeCoef(SBout)
## Not run:
krCI(SBout)
bootCI(SBout)
## End(Not run)
plot(SBout, main = "Spike SB model")
# Spike DB Example
db <- data.frame(
bidh = c(30, 60, 120),
bid1 = c(10, 30, 60),
bidl = c(5, 10, 30),
yy = c(119, 69, 54),
yn = c(59, 69, 75),
ny = c(8, 31, 25),
nny = c(47, 61, 35),
nnn = c(31, 37, 66))
DB <- ct2df(x = db, type = "double", spike = TRUE)
head(DB)
dim(DB)
DBout <- dbspike(R1 + R2 | S ~ 1 | bid1 + bid2, data = DB)
summary(DBout)
spikeCoef(DBout)
## Not run:
krCI(DBout)
bootCI(DBout)
## End(Not run)
plot(DBout, main = "Spike DB model")
# Spike OOHB Example
oohb <- data.frame(
bidl = c(2, 4, 6, 8),
bidh = c(4, 6, 8, 10),
yy = c(8, 6, 4, 2),
yn = c(1, 3, 1, 1),
n_y = c(1, 1, 4, 4),
n_n = c(0, 1, 1, 3),
y = c(7, 6, 3, 1),
ny = c(2, 2, 3, 1),
nn_y = c(1, 1, 2, 5),
nn_n = c(0, 0, 2, 3))
OOHB <- ct2df(x = oohb, type = "oohb", spike = TRUE)
head(OOHB)
dim(OOHB)
OOHBout <- oohbspike(R1 + R2 | S ~ 1 | BL + BH, data = OOHB)
summary(OOHBout)
spikeCoef(OOHBout)
## Not run:
krCI(OOHBout)
bootCI(OOHBout)
## End(Not run)
plot(OOHBout, main = "Spike OOHB model")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.