Description Usage Arguments Value Examples
View source: R/make_willingness_utility.R
Function accepts from a numeric variable of payment the respondent is willing to make. The function produces table with three variables: price- this is a spreading of the willing to pay price on a new scale prop_willing- proportion of respondents that are willing to pay any given price utility- prop_willing * price
1 2 3 4 5 6 7 | make_willingness_utility(
x,
money_pay_var_string,
jump = 1,
var_min = NA,
var_max = NA
)
|
x |
a tbl() with the data. |
money_pay_var_string |
Target variable name as string, represents money. |
jump |
by defoult ==1 jumps on the cost axis |
var_min |
by defoult = NA, allows you to specify the minimal value |
var_max |
by defoult = NA, allows you to specify the maximal value |
the function generates the cost, 1-ecdf willingness to pay cost value, and utility
1 2 3 4 5 6 7 | quality_assurance <- data.frame(
ID = 1:500,
money_willing_to_pay = sample(seq(0,20,5), size = 500, replace = T),
year = sample(c("2018", "2019", "2020"), size = 500, replace = T))
quality_assurance %>%
make_willingness_utility(money_pay_var_string = "money_willing_to_pay")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.