Open UrbanFercecNchain opened 7 months ago
Hello, I encounter the same issue. I'm also working with prices (continuous) and a no-choice alternative.
I even tried with the CEA function and with increased "n.set" just to be sure. But I never get a choice set including the third and fourth level for this continuous attribute.
Here is my code :
# 1. Define attribute levels and coding type for each attribute
# In this example, three attributes are defined (AOC, Production Method, and Price)
levels <- c(2, 3, 4) # AOC; Production Method (Conv, HVE, AB), and Price (€4, €6.25, €8.5, €10.75)
code <- c("D", "D", "C") # Use dummy coding for the first two attributes and continuous coding for price
n.sets <- 12 # Multiple of attribute levels!
alt.cte <- c(0, 0, 1) # Alternative-specific constant (ASC) for the no-choice alternative
n.alts <- 3
lev_price <- list(c(4, 6.25, 8.5, 10.75))
# 2. Generate the list of candidate profiles
# This step generates all possible combinations of attribute levels.
cand.set <- Profiles(lvls = levels, coding = code, c.lvls = lev_price) # 24 possible combinations = 24 candidate sets
# 3. Define prior parameters for preference coefficients
mu <- c(0, 0.02, 0.87, 0.96, -0.18) # Mean of preference coefficient distributions for priors
# First coefficient corresponds to ASC for the no-choice alternative
sigma <- diag(length(mu)) # Covariance matrix (diagonal) for coefficients
# Generate draws from the prior distribution for Bayesian design
set.seed(123) # For reproducibility
par.draws <- MASS::mvrnorm(n = 200, mu = mu, Sigma = sigma)
# Adjust the structure of the parameter draws
par.draws <- list(par.draws[, 1], par.draws[, 2:5])
# 4. Create an optimal (D-efficient) design using the idefix package
# Use the modified Federov algorithm to generate a design minimizing D(B)-error.
design <- Modfed(cand.set = cand.set, n.sets = n.sets, n.alts = n.alts, par.draws = par.draws, no.choice = TRUE, alt.cte = alt.cte, best = TRUE, parallel = TRUE)
# Alternative approach: Create a CEA (Choice Experiment Algorithm) design
design <- CEA(lvls = levels, coding = code, par.draws = par.draws, n.alts = n.alts, n.sets = n.sets, parallel = TRUE, c.lvls = lev_price, alt.cte = alt.cte, no.choice = TRUE)
I also may have done something wrong.
Thanks in advance!
Nb: When this attribute is dummy coded I get all its level attributes. The issue might be related to the "continuous" type of coding.
Dear Developers,
I am conducting a DCE experiment with 5 variables for which I would like to use your software to optimize the choice sets. For the first trial design, I have no priors, which means that values for all variable levels should be somewhat uniformly present in the result set. This appears to be the case for all discrete variables but isn't for my value of continuous variable. Specifically, in about 90% of all alternatives I get the lowest number while the highest is not even present, which to me seems like an error. I am providing you with my code below.
If I run this, I get 1.8€ in 20 of alternatives and 3.3€ in 4. However, is it more then possible that I have made an error somewhere and that your software is working perfectly. That being said, I would kindly ask you for your help.