Page 1 of 1

Constrained designs with covariate

PostPosted: Fri Sep 01, 2023 3:48 pm
by Reihaneh
Dear Ngene team,

I am currently designing a survey for mode choice models that incorporate alternatives, such as auto, passenger, transit, walk, and bike. Within this design, there is a covariate known as "Parking cost," which is set at three different levels: $10(small), $40(high), and no charge(Nopark). It's important to note that this cost is halved for the passenger mode. To account for this adjustment, I have implemented constraints in my Ngene code. However, I have encountered an error when running the code, which reads as follows: "Error: An attribute, 'pcpass,' specified in the ';cond' property could not be found."

Could you kindly assist me in resolving this error? I have attached the relevant code for your reference.
In the following code, "short" refers to short trips. I have another Ngene design for medium and long trips. The reason for this separation is that the number of alternatives for medium and long trips (auto, passenger, transit) is fewer than for short trips, and another error occurs when I run the full code. Is there any solution for this problem?


Design
;alts(small_short) = auto, passenger, transit, walk, bike
;alts(high_short) = auto, passenger, transit, walk, bike
;alts(Nopark_short) = auto, passenger, transit, walk, bike
;rows=6
;eff= Fish(mnl,d)
;fisher(Fish) = des1(small_short[0.468]) +
des4(high_short[0.216]) +
des7(Nopark_short[0.316])

;cond:
if(auto.TTautoS=[12], PCpass=[5]),
if(auto.TTautoS=[15], PCpass=[20]),
if(auto.TTautoS=[18], PCpass=[0])

;model(small_short):
U(auto)= b_autoTT[(u,-0.075,-0.0505)] * TTautoS[12,15,18] +
b_TC[(u,-0.552,-0.368)] * TCautoS[4,5,6] +
b_autoPC[(u,-0.761,-0.507)] * PCauto.covar[10] +
b_autoPC * PHauto[0,1,2]
/

U(passenger)= b_autoTT * TTautoS +
b_TC * TCpassS[2,2.5,3] +
b_autoPC * PCpass[0,5,20] +
b_autoPC * PHpass[0,0.5,1]
/

U(transit)= b_tranTT[(u,-0.055,-0.037)] * TTtranS[10,13,16] +
b_TC * TCtranS[2,2.5,3] +
b_tranWait[(u,-0.39,-0.083)] * WaittranS[2,4,6] +
b_tranWalk[(u,-0.039,-0.026)]* Walktran[3,5,7]
/

U(walk)= b_walkDis[(u,-4.49,-2.99)]
/

U(bike)= b_bikeDis[(u,-0.471,-0.314)] +
b_bikeShareSt[(u,0.3,0.7)] * FreeBikeShareSt[0,1] +
b_bikeshareM[(u,-0.2,-0.1)] * FreeBikeShareM[0,60,120] +
b_bikePark[(u,0.3,0.7)] * FreeBikePark[0,1] +
b_bikeElecSt[(u,0.54,1.25)] * FreeEbikeSt[0,1] +
b_bikeRepSt[(u,0.18,0.42)] * BikeRepairSt[0,1] +
b_bikeRepTu[(u,1,3)] * FreeBikeTuning[0,1]



;model(high_short):
U(auto)= b_autoTT[(u,-0.075,-0.0505)] * TTautoS[12,15,18] +
b_TC[(u,-0.552,-0.368)] * TCautoS[4,5,6] +
b_autoPC[(u,-0.761,-0.507)] * PCauto.covar[40] +
b_autoPC * PHauto[0,1,2]
/

U(passenger)= b_autoTT * TTautoS +
b_TC * TCpassS[2,2.5,3] +
b_autoPC * PCpass[0,5,20] +
b_autoPC * PHpass[0,0.5,1]
/

U(transit)= b_tranTT[(u,-0.055,-0.037)] * TTtranS[10,13,16] +
b_TC * TCtranS[2,2.5,3] +
b_tranWait[(u,-0.39,-0.083)] * WaittranS[2,4,6] +
b_tranWalk[(u,-0.039,-0.026)]* Walktran[3,5,7]
/

U(walk)= b_walkDis[(u,-4.49,-2.99)]
/

U(bike)= b_bikeDis[(u,-0.471,-0.314)] +
b_bikeShareSt[(u,0.3,0.7)] * FreeBikeShareSt[0,1] +
b_bikeshareM[(u,-0.2,-0.1)] * FreeBikeShareM[0,60,120] +
b_bikePark[(u,0.3,0.7)] * FreeBikePark[0,1] +
b_bikeElecSt[(u,0.54,1.25)] * FreeEbikeSt[0,1] +
b_bikeRepSt[(u,0.18,0.42)] * BikeRepairSt[0,1] +
b_bikeRepTu[(u,1,3)] * FreeBikeTuning[0,1]




;model(Nopark_short):
U(auto)= b_autoTT[(u,-0.075,-0.0505)] * TTautoS[12,15,18] +
b_TC[(u,-0.552,-0.368)] * TCautoS[4,5,6] +
b_autoPC[(u,-0.761,-0.507)] * PCauto.covar[0] +
b_autoPC * PHauto[0,1,2]
/

U(passenger)= b_autoTT * TTautoS +
b_TC * TCpassS[2,2.5,3] +
b_autoPC * PCpass[0,5,20] +
b_autoPC * PHpass[0,0.5,1]
/

U(transit)= b_tranTT[(u,-0.055,-0.037)] * TTtranS[10,13,16] +
b_TC * TCtranS[2,2.5,3] +
b_tranWait[(u,-0.39,-0.083)] * WaittranS[2,4,6] +
b_tranWalk[(u,-0.039,-0.026)]* Walktran[3,5,7]
/

U(walk)= b_walkDis[(u,-4.49,-2.99)]
/

U(bike)= b_bikeDis[(u,-0.471,-0.314)] +
b_bikeShareSt[(u,0.3,0.7)] * FreeBikeShareSt[0,1] +
b_bikeshareM[(u,-0.2,-0.1)] * FreeBikeShareM[0,60,120] +
b_bikePark[(u,0.3,0.7)] * FreeBikePark[0,1] +
b_bikeElecSt[(u,0.54,1.25)] * FreeEbikeSt[0,1] +
b_bikeRepSt[(u,0.18,0.42)] * BikeRepairSt[0,1] +
b_bikeRepTu[(u,1,3)] * FreeBikeTuning[0,1]



$



Thank you for your assistance.
Reihaneh

Re: Constrained designs with covariate

PostPosted: Sat Sep 02, 2023 8:55 am
by Michiel Bliemer
There are a few issues.

1. Imposing constraints is incompatible with the Fisher property.
2. The constraints create perfect correlations between TTauto and PCpass and you would no longer be able to estimate their coefficients (infinite D-error).
3. The correct syntax would have been passenger.PCpass instead of PCpass.

If you need to use constraints, then the only way to currently generate the designs is to generate the three designs separately instead of simultaneously using the Fisher property. While this may be slightly less efficient than simultaneous optimisation, the difference is likely marginal.

Note that you may want to increase the number of rows since 6 rows is very restrictive, especially with the default swapping algorithm that maintains attribute level balance. Using 12 rows for each design is likely a much better idea as it creates more variation in your data and increases the search space for finding a more efficient design.

Michiel