questions about continuous variables in Ngene

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

questions about continuous variables in Ngene

Postby uuuu » Thu Oct 14, 2021 11:36 pm

Hello,

My questions are regarding dealing with continuous variables in Ngene.

The first question is about using the two-step method suggested in Chapter 9 of the manual. I wonder why one of my attributes (E) in the final design results has three levels (0,1,2), while the utility function I set for this attribute includes only two levels (0 and 1). The initial design results saved in the first step (without the salary variable, the continuous variable) didn't have this problem.

The initial design (the first step):
Design
;alts=alt1,alt2,alt3
;rows=18
;eff=(mnl,d)
;model:
U(alt1)=b1+b2[-0.354]*A[0,1,2]+b3[-0.831]*B[0,1,2]+b4[-0.567]*C[0,1,2]+b5[-0.068]*D[0,1,2]+b6[0.508]*E[1,0]+b7[-0.511]*F[0,1,2]+b8[0.204]*G[1,0]+b9[-0.343]*H[1,0]+b10[-0.723]*I[1,0]+b11[0.348]*J[1,0]/
U(alt2)=b1*A+b2*B+b4*C+b5*D+b6*E+b7*F+b8*G+b9*H+b10*I+b11*J[1,0]
$

The second step for continuous variable:
Design
;alts=alt1,alt2,alt3
;rows=18
;eff=(mnl,d)
;alg=neldermead(nointerim=0,stop=total(5000 iterations))
;start=Untitled design 1.ngd
;model:
U(alt1)=b1+b2[-0.354]*A[0,1,2]+b3[-0.831]*B[0,1,2]+b4[-0.567]*C[0,1,2]+b5[-0.068]*D[0,1,2]+b6[0.508]*E[1,0]+b7[-0.511]*F[0,1,2]+b8[0.204]*G[1,0]+b9[-0.343]*H[1,0]+b10[-0.723]*I[1,0]+b11[0.348]*J[1,0]+b12[0.206]*K[20:29]/
U(alt2)=b1*A+b2*B+b4*C+b5*D+b6*E+b7*F+b8*G+b9*H+b10*I+b11*J[1,0]+b12*K[20:29]
$



(As we haven't figured out why the two-step method for continuous variables mentioned in the Chapter 9 didn't work in our case.) The second question is whether it is appropriate if we just specify the salary variable [K] as the continuous variable (rather than with discrete levels, e.g., K[0,1,2,3]) in the utility function, and do the D-efficient design in one step as below?

Design
;alts=alt1,alt2,alt3
;rows=36
;block=2
;eff=(mnl,d)
;model:
U(alt1)=b1+b2[-0.354]*A[0,1,2]+b3[-0.831]*B[0,1,2]+b4[-0.567]*C[0,1,2]+b5[-0.068]*D[0,1,2]+b6[0.508]*E[1,0]+b7[-0.511]*F[0,1,2]+b8[0.204]*G[1,0]+b9[-0.343]*H[1,0]+b10[-0.723]*I[1,0]+b11[0.348]*J[1,0]+b12[0.206]*K[20:29]
U(alt2)=b1*A+b2*B+b4*C+b5*D+b6*E+b7*F+b8*G+b9*H+b10*I+b11*J[1,0]+b12*K[20:29]
$


Thanks much for your help!

Michelle
uuuu
 
Posts: 1
Joined: Thu Oct 14, 2021 12:44 pm

Re: questions about continuous variables in Ngene

Postby Michiel Bliemer » Fri Oct 15, 2021 8:01 am

Hi Michelle,

I do not know why attribute E shows up with three levels, that is odd.

I did notice a few issues with your syntax.

1. You used b1 as a constant but also as a parameter for attribute A in the second alternative. And you used b2 as the coefficient for attribute A in alternative A but as a coefficient for attribute B in alternative 2. I have fixed this in the syntax below.

2. You have levels 0,1,2 for some attributes, but you do not use dummy or effects coding. This is suspicious. For all qualitative variables, you need to use something like b2.dummy[..|..] * A[0,1,2], where the last level (2) is the base level for dummy coding. You need to specify the utility function exactly as you would in model estimation, and qualitative variables require dummy or effects coding, it is not appropriate to use levels 0,1,2 directly in the utility function.

3. Instead of using the neldermead optimisation, I recommend that you use K{20:29:1], which creates levels 20,21,22,23,24,25,26,26,28,29, which is essentially the same as creating a continuous variable.

4. You also need a prior for constant b1, preferably from a pilot study. Without setting a prior for the constant, your choice probabilities for the three alternatives will be quite wrong, which will have a negative impact on design efficiency. If you are uncertain about priors, then you can use (near) zero priors for all parameters until you have conducted a pilot study.

Code: Select all
Design
;alts=alt1,alt2,alt3
;rows=36
;block=2
;eff=(mnl,d)
;model:
U(alt1)=b1+b2[-0.354]*A[0,1,2]+b3[-0.831]*B[0,1,2]+b4[-0.567]*C[0,1,2]+b5[-0.068]*D[0,1,2]+b6[0.508]*E[1,0]+b7[-0.511]*F[0,1,2]+b8[0.204]*G[1,0]+b9[-0.343]*H[1,0]+b10[-0.723]*I[1,0]+b11[0.348]*J[1,0]+b12[0.206]*K[20:29:1] /
U(alt2)=b1+b2*A+b3*B+b4*C+b5*D+b6*E+b7*F+b8*G+b9*H+b10*I+b11*J[1,0]+b12*K
$


Michiel
Michiel Bliemer
 
Posts: 1727
Joined: Tue Mar 31, 2009 4:13 pm


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 11 guests