1
$\begingroup$

I have a large panel on the city level of how many cars of each {model, fueltype} combination were newly registered in each year. This panel also includes a large variety of characteristics for each car model (including the price). I'd like to calculate the average WTP of consumers for certain attributes of the cars (e.g. what's the WTP for heated seats) and through that find out, what the determinate of vehicle choice are. I thought about approaching this issue with a random coefficient logit model. Are there any other suggestions on how to approach this?

Sample data for R:

rm(list = ls()) library(dplyr)
data_2020 <- data.frame( city = rep(paste0("city", 1:100), each = 3), car = rep(c("BMW", "Audi", "VW"), 100), count = sample(100:300, 300, replace = TRUE), year = 2020 ) %>% mutate( price = ifelse(car == "BMW", 30000, ifelse(car == "Audi", 25000, 20000)), range = ifelse(car == "BMW", 400, ifelse(car == "Audi", 450, 350)), heated_seats = ifelse(car == "BMW" | car == "Audi", 1, 0) )
data_2021 <- data.frame( city = rep(paste0("city", 1:100), each = 3), car = rep(c("BMW", "Audi", "VW"), 100), count = sample(100:300, 300, replace = TRUE), year = 2021 ) %>% mutate( price = ifelse(car == "BMW", 30000, ifelse(car == "Audi", 25000, 20000)), range = ifelse(car == "BMW", 400, ifelse(car == "Audi", 450, 350)), heated_seats = ifelse(car == "BMW" | car == "Audi", 1, 0) )
data_2022<- data.frame( city = rep(paste0("city", 1:100), each = 3), car = rep(c("BMW", "Audi", "VW"), 100), count = sample(100:300, 300, replace = TRUE), year = 2022 ) %>% mutate( price = ifelse(car == "BMW", 30000, ifelse(car == "Audi", 25000, 20000)), range = ifelse(car == "BMW", 400, ifelse(car == "Audi", 450, 350)), heated_seats = ifelse(car == "BMW" | car == "Audi", 1, 0) )
data <- rbind(data_2020, data_2021, data_2022) %>% arrange(city, car, year) ´
$\endgroup$
1
  • $\begingroup$ Would you mind and edit you post a bit so we can actually read the code? Thanks $\endgroup$
    – T123
    Commented Jan 10 at 19:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.