Hi there,

test = 0 or 1 or 2

Glogit (mlogit) takes test=0 as reference.

> If test=1 then NEW=0
> If test=2 then NEW=1
> If test=3 then NEW=2

What I meant was of course not the above simple re-specification! There is
no 3 ;-)
So here correctly stated:

 If test=1 then NEW=0
 If test=2 then NEW=1

 If test=0 then NEW=2

Glogit now takes NEW=0=test=1 as reference! I want to estimate three glogit
models.
In SAS there is a 'ref' parameter allowing to change the reference category.

I succeeded in producing this NEW series, but I'm not happy with my current
solution.
It's tedious and produces 1767 scalars I don't need further (and takes
relatively long).
By the way, what is the command to give me the total sample size, which is
this case is 1767?

series NEW =0
loop for (i=1;i<=1767;i+=1) --quiet
    test_$i = TEST[i]
    if test_$i =2
        NEW[i]=1
    elif test_$i =1
        NEW[i]=0
    else
         NEW[i]=2
     endif
endloop

Cheers
Pindar

-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu
[mailto:gretl-users-bounces(a)lists.wfu.edu] Im Auftrag von Allin Cottrell
Gesendet: Samstag, 3. Juli 2010 18:41
An: Gretl list
Betreff: Re: [Gretl-users] creating a discrete variable?


On Sat, 3 Jul 2010, Pindar wrote:

> I've got a discrete nomial variable  TEST = 0 or 1 or 2
> If I estimate a multinomial model the base is 0.
> Now I want to change the reference. What is the best way to do it?
> How can I create a new discrete variable that follows the following
> specification:
>
> If test=1 then NEW=0
> If test=2 then NEW=1
> If test=3 then NEW=2

Looks like "series NEW = test - 1" would do the job. Follow this
with "discrete NEW" if you want the series "officially" marked as
being discrete.

Allin Cottrell

_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users


Reply via email to