undefined D-error

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

undefined D-error

Postby eva_boon » Sun May 05, 2019 6:13 pm

Hello

I want to design a choice experiment about the trade-off households make concerning the amount of children and the quality of child-raising. My design includes the following attributes:

*ChildM: number of boys ranging from 1-12 with 6 levels (1,2,4,6,9,12)
*ChildF: number of girls (1,2,4,6,9,12)
*PrimM: the amount of boys sent to primary school (1,2,4,6,9,12)
*PrimF: the amount of girls sent to primary school (1,2,4,6,9,12)
*SecM: the amount of boys sent to secondary school (1,2,4,6,9,12)
*secF: the amount of girls sent to secondary school (1,2,4,6,9,12)
*TertM: the amount of boys sent to tertiary school (1,2,4,6,9,12)
*TertF: the amount of girls sent to tertiary school (1,2,4,6,9,12)

I have made different designs, once with the variables as categorical factors with dummy coding and once as numerical factors. For each design, I made a model with linear effects only, linear and 2-factor interaction effects, and linear, 2-factor interaction effects and quadratic effects. I want to choose the most efficient design, by comparing the D-errors, although for most of my designs (except the linear model with numerical factors) I get an undefined D-error.

This is my code for the linear model with categorical factors:
Design

;alts = alt1*, alt2*
? Each choice set has two options (and no opt-out option)

;rows = 48
;block = 4, minsum
? In total 48 choice sets are created that are blocked in 4 blocks of each 12 choice sets. So every respondent has to answer 12 choice sets.

;eff = (mnl, d)
? I generate a D-efficient design for a multinomial logit model

;alg = mfederov(candidates=10000000)
? Modified Federov algorithm: necessary for the requirements

?;require:
alt1.ChildM + alt1.ChildF <= 12,
alt1.ChildM + alt1.ChildF >= alt1.PrimM + alt1.PrimF,
alt1.PrimM + alt1.PrimF >= alt1.SecM + alt1.SecF,
alt1.SecM + alt1.SecF >= alt1.TertM + alt1.TertF,
alt2.ChildM + alt2.ChildF <= 12,
alt2.ChildM + alt2.ChildF >= alt2.PrimM + alt2.PrimF,
alt2.PrimM + alt2.PrimF >= alt2.SecM + alt2.SecF,
alt2.SecM + alt2.SecF >= alt2.TertM + alt2.TertF
? The number of boys and girls must be smaller than 12 + The number of children cannot be bigger than in the previous attribute

;model:
U(alt1) = b1.dummy[0.01|0.02|0.03|0.02|0.01] * ChildM[2,4,6,9,12,1]
+ b2.dummy[0.01|0.02|0.03|0.02|0.01] * ChildF[2,4,6,9,12,1]
+ b3.dummy[0.01|0.015|0.02|0.025|0.03] * PrimM[2,4,6,9,12,1]
+ b4.dummy[0.01|0.015|0.02|0.025|0.03] * PrimF[2,4,6,9,12,1]
+ b5.dummy[0.015|0.02|0.025|0.03|0.035] * SecM[2,4,6,9,12,1]
+ b6.dummy[0.015|0.02|0.025|0.03|0.035] * SecF[2,4,6,9,12,1]
+ b7.dummy[0.02|0.025|0.03|0.035|0.04] * TertM[2,4,6,9,12,1]
+ b8.dummy[0.02|0.025|0.03|0.035|0.04] * TertF[2,4,6,9,12,1] /

U(alt2) = b1 * ChildM
+ b2 * ChildF
+ b3 * PrimM
+ b4 * PrimF
+ b5 * SecM
+ b6 * SecF
+ b7 * TertM
+ b8 * TertF

$

Why do I get an undefined D-error? I think the problem is related to the constraints, because when I delete the constraints, I get a finite D-error, but I have no idea what the problem is.

Any help would be really appreciated.

Thanks

Eva
eva_boon
 
Posts: 2
Joined: Sun May 05, 2019 6:11 am

Re: undefined D-error

Postby Michiel Bliemer » Mon May 06, 2019 9:05 am

There are a few issues with the syntax:

1. There is a ? in front of ;require, that does not seem right. Either remove this ? or add a ? in front of all constraints in order to comment them out.
2. The number of candidates is far too large, usually around 2000 or so is enough
3. Your constraints are very restrictive and there will not exist any feasible design; you require that ChildM + ChildF <=12, but that means that ChildM = 12 and ChildF = 12 cannot exist as levels and therefore the model cannot be estimated and receives an undefined D-error. Please carefully check all your constraints to make sure that there exist feasible choice tasks.

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

Re: undefined D-error

Postby eva_boon » Sun May 12, 2019 5:30 pm

Thank you very much for your answer!

Now I changed the possible levels with a maximum of 11 instead of 12 and I changed the number of candidates to 2000, but then I get the Error message: "There were problems generating a fractional factorial of choice tasks. For the modified federov algorithm, increasing the number of candidates might assist." So, increasing this number till 2000000 eliminates this error message but then I still have an undefined D-error.

Here is again my script:
;alts = alt1*, alt2*
? Each choice set has two options (and no opt-out option)

;rows = 48
;block = 4, minsum
? In total 48 choice sets are created that are blocked in 4 blocks of each 12 choice sets. So every respondent has to answer 12 choice sets.

;eff = (mnl, d)
? I generate a D-efficient design for a multinomial logit model

;alg = mfederov(candidates=2000000)
? Modified Federov algorithm: necessary for the requirements

;require:
alt1.ChildM + alt1.ChildF <= 12,
alt1.ChildM + alt1.ChildF >= alt1.PrimM + alt1.PrimF,
alt1.PrimM + alt1.PrimF >= alt1.SecM + alt1.SecF,
alt1.SecM + alt1.SecF >= alt1.TertM + alt1.TertF,
alt2.ChildM + alt2.ChildF <= 12,
alt2.ChildM + alt2.ChildF >= alt2.PrimM + alt2.PrimF,
alt2.PrimM + alt2.PrimF >= alt2.SecM + alt2.SecF,
alt2.SecM + alt2.SecF >= alt2.TertM + alt2.TertF
? The number of boys and girls must be smaller than 12 + The number of children cannot be bigger than in the previous attribute

;model:
U(alt1) = b1.dummy[0.01|0.02|0.03|0.02|0.01] * ChildM[2,4,6,9,11,1]
+ b2.dummy[0.01|0.02|0.03|0.02|0.01] * ChildF[2,4,6,9,11,1]
+ b3.dummy[0.01|0.015|0.02|0.025|0.03] * PrimM[2,4,6,9,11,1]
+ b4.dummy[0.01|0.015|0.02|0.025|0.03] * PrimF[2,4,6,9,11,1]
+ b5.dummy[0.015|0.02|0.025|0.03|0.035] * SecM[2,4,6,9,11,1]
+ b6.dummy[0.015|0.02|0.025|0.03|0.035] * SecF[2,4,6,9,11,1]
+ b7.dummy[0.02|0.025|0.03|0.035|0.04] * TertM[2,4,6,9,11,1]
+ b8.dummy[0.02|0.025|0.03|0.035|0.04] * TertF[2,4,6,9,11,1] /

U(alt2) = b1 * ChildM
+ b2 * ChildF
+ b3 * PrimM
+ b4 * PrimF
+ b5 * SecM
+ b6 * SecF
+ b7 * TertM
+ b8 * TertF
$

Any idea how I can solve this?

Thank you very much in advance. Your help is really appreciated.

Kind regards

Eva
eva_boon
 
Posts: 2
Joined: Sun May 05, 2019 6:11 am

Re: undefined D-error

Postby Michiel Bliemer » Mon May 13, 2019 12:07 pm

It looks like you are putting too many constraints on your design such that your model can no longer be estimated.

There only exist very few feasible choice tasks satisfying all your constraints. For example, you can set candidates=200 or 300 or something and it will run but will give an undefined D-error since your model is not identifiable due to your constraints. Ngene will find it difficult finding more than 400 feasible choice tasks (note that these are generated by drawing choice tasks randomly and then verifying them against your constraints so running the syntax again will give you a different candidate set).

You should make sure that your model parameters are identifiable together with your constraints. Your constraints are very strict such that level 11 will not appear for the TertM and TertF attributes, at least it is unlikely that Ngene is able to generate feasible choice tasks by randomly drawing from the full factorial design.

If you think that feasible choice tasks where TertM=1 or TertF=11 exist then you may want to create the candidate set yourself (e.g. in Excel) and open it in Ngene and use something like ;alg = mfederov(candidates = externalcandidateset.csv).

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


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 8 guests

cron