Simulations in Ngene

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

Simulations in Ngene

Postby mham0997 » Thu Dec 03, 2020 4:27 pm

Hi,

I have been advised to run some simulations first before finalising the design of the DCE, so was wondering does Ngene have this capacity? I was reading the manual and found some info on 'random draws' is this the same thing?

Regards,
Melanie
mham0997
 
Posts: 9
Joined: Wed Nov 04, 2020 4:23 pm

Re: Simulations in Ngene

Postby Michiel Bliemer » Thu Dec 03, 2020 6:04 pm

I generally simulate choice responses manually in Excel, which is quite easy, Ngene does not have a separate functionality to do this, but it can be tricked to do this. Random draws are used for drawing parameter values from random coefficients to compute the D-error for mixed logit models, so that is not what you need.

Suppose that you have created a design with the following syntax:

Code: Select all
design
;alts = route1, route2
;rows = 12
;eff = (mnl,d)
;model:
U(route1) = tt-0.2] * traveltime[5,10,15,20] + tc[-1.2] * travelcost[1,2,3,4] /
U(route2) = tt[-0.2] * traveltime[5,10,15,20] + tc[-1.2] * travelcost[1,2,3,4]
$


You can then save the design in Ngene, say as design.ngd. You can then evaluate the design, and put in extra syntax that mimics a panel mixed logit model with random coefficients, such as below, where a normally distributed pameters with a mean of -0.2 and a standard deviation of 0 is essentially a fixed parameter with a value of -0.2. This syntax will create a sample of 100 respondents with simulated choices, ;rep = 100 indicates creating a sample of 100 respondents. This command only works with panel mixed logit models as sample generation is not needed to compute the D-error for other model types.

Code: Select all
design
;alts = route1, route2
;rows = 12
;eff = (mnl,d)
;eval = design.ngd
;rdraws = gauss(1)
;rep = 100
;model:
U(route1) = tt[n,-0.2,0] * traveltime[5,10,15,20] + tc[n,-1.2,0] * travelcost[1,2,3,4] /
U(route2) = tt[n,-0.2,0] * traveltime[5,10,15,20] + tc[n,-1.2,0] * travelcost[1,2,3,4]
$


You can find the sample by opening the design, clcking on "Design properties, RP Panel" and then click on "Sample", where you will see simulated choice observations in the column "Choice". You can use this data to estimate a model in model estimation software like Nlogit, Biogeme, or Apollo to verify that you can estimate your model parameters using the design.

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

Re: Simulations in Ngene

Postby mham0997 » Mon Jan 18, 2021 1:35 pm

Dear Michael,

Apologies for the delay in replying to this, I have been away and only getting back to my project now. I have tried to run the design with the extra syntax :

;eval = design.ngd
;rdraws = gauss(1)
;rep = 100

However, it says 'error eval property could not be opened' I have saved the design but may not be doing this correctly?

Also, will running this 'simulation' help me to establish priors?

Regards,
Melanie
mham0997
 
Posts: 9
Joined: Wed Nov 04, 2020 4:23 pm

Re: Simulations in Ngene

Postby Michiel Bliemer » Mon Jan 18, 2021 4:44 pm

First, create a new project and open the design in Ngene (choosing Open from the menu) so that it is available locally. It will then be available in your project.

No simulations will not help to establish priors, because priors are input into the simulation as you can see from my syntax.

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


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 10 guests