Page 1 of 1

Same attribute names but different levels

PostPosted: Fri Feb 15, 2019 3:04 pm
by xiaoxiadong
Dear Ngene team,

I have an embarrassingly basic question and was hoping you could share some insight. Let's say I have three attributes for two alternatives. Attribute A has different levels across alternatives. When I ran the following script,

Design
;alts = alt1, alt2
;rows = all
;fact
;model:
U(alt1) = b1 + b2 * A[0,1,2] + b3 * B[0,1] /
U(alt2) = b2 * A[2,3] + b4 * C[2,4,6,8]
$

I got the error message:
[Error: Two identically named attributes do not have consistently specified levels: 'alt2.a', 'alt1.a']

I was under the impression that different utility functions may have attributes with identical names but different levels. According to page 48 in the manual,
“If the levels are different, then the attribute level values will need to be added. Note that
one can use the same attribute name in different utility functions as Ngene will treat them
separately (Ngene will refer to them in the output as ‘alt1.A’ and ‘alt2.A’, etc.).”

The code worked when I changed attribute A to a different name but I was wondering if there was a way for it to work without changing the attribute name.

Thank you in advance for your time and help!

Re: Same attribute names but different levels

PostPosted: Sat Feb 16, 2019 9:57 am
by Michiel Bliemer
No it will only work if you give the attributes different names since the allowed levels are attached to the name. Note that giving attributes a different name does not make any difference to the model you are estimating since A[0,1,2] and A2[2,3] both have generic coefficient b2 and that is the relevant part.

Michiel

Re: Same attribute names but different levels

PostPosted: Sat Feb 16, 2019 10:10 am
by xiaoxiadong
Thank you so much for the clarification! I really appreciate it!