Page 1 of 1

Create series for multinomial logit

Posted: Sat Jan 31, 2009 4:33 am
by fionakerr
Hi,

I am trying to create an ordered series so I can perform multinomial logit regressions.

I am looking to create this;
y=0 if x<=0
y=1 if 0<x<=2.5
y=2 if 2.5<x<=7.5
etc...

So far I have used the below method without success.

series xordered=((x<=0,x,0) and (x>0 and x<=2.5,x,1) and (x>2.5 and x<=7.5,x,2) and (x>7.5 and x<=15,x,3) and (x>15 and x<=30,x,4) and (x>30,x,5))

Any advice would be greatly appreciated!
Thanks!

Re: Create series for multinomial logit

Posted: Sat Jan 31, 2009 6:06 am
by startz
Hi,

I am trying to create an ordered series so I can perform multinomial logit regressions.

I am looking to create this;
y=0 if x<=0
y=1 if 0<x<=2.5
y=2 if 2.5<x<=7.5
etc...

So far I have used the below method without success.

series xordered=((x<=0,x,0) and (x>0 and x<=2.5,x,1) and (x>2.5 and x<=7.5,x,2) and (x>7.5 and x<=15,x,3) and (x>15 and x<=30,x,4) and (x>30,x,5))

Any advice would be greatly appreciated!
Thanks!
One method

Code: Select all

smpl if x<=0 y=0 smpl if 0<x and x<=2.5 y=1 smpl if 2.5<x and x<=7.5 y=2

Re: Create series for multinomial logit

Posted: Mon Feb 02, 2009 10:24 am
by EViews Glenn
Another method:

Code: Select all

x.classify(method=limits, rightclosed) 0 2.5 7.5 @ y
The one issue here is that the encoding will start from 1 instead of 0. You can, using the same proc, define value maps for the encoding which will be attached to the resulting series.