Hi everybody. I have a binary series named xyc (default indicator, dependent variable) where ones are in minority.
I would like to form a new sample where all items which are ones are included and certain portion of zeros included (let's say 30% of the remaining series) but this remaining portion to be selected in a random manner...sort of bootstrapping ...can it be done ?
Best regards
Series manipulation
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Series manipulation
Code: Select all
smpl if xyc=1 or rnd<.3
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Series manipulation
Startz solution will give a sample including all the 1s, and where each 0 has a 30% chance of being included, which is not quite the same as saying that 30% of the zeros will be included (in a finite sample).
Re: Series manipulation
Thanks a lot Starz, very elegant solution :)
Gareth do you have something else in mind? Let's say I want to include all defaults =1 and the first 1/3 zeros then second portion of 1/3 zeros and the last third (and to check different results of logit)...how to do it? can I use something @first....?
best regards
Gareth do you have something else in mind? Let's say I want to include all defaults =1 and the first 1/3 zeros then second portion of 1/3 zeros and the last third (and to check different results of logit)...how to do it? can I use something @first....?
best regards
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Series manipulation
ugly, but should work:
Code: Select all
smpl @first @first
series trend0=xyc=1
smpl @first+1 @last
series trend0 = @recode(xyc=1, trend0(-1), trend0(-1)+1)
smpl if xyc=1 or trend0<(1/3)*@max(trend0) or trend0>(2/3)*@max(trend0)
Re: Series manipulation
hey, far from ugly :)
Could I ask for some explanation (as it is a bit advanced for me...)??
e.g. @first @first - it means first two observations are taken ?
and the middle part
smpl @first+1 @last /excludes the first two??/
series trend0 = @recode(xyc=1, trend0(-1), trend0(-1)+1)
what does it mean? and how does it work :D ??
Thanks a lot!
Could I ask for some explanation (as it is a bit advanced for me...)??
e.g. @first @first - it means first two observations are taken ?
and the middle part
smpl @first+1 @last /excludes the first two??/
series trend0 = @recode(xyc=1, trend0(-1), trend0(-1)+1)
what does it mean? and how does it work :D ??
Thanks a lot!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Series manipulation
Code: Select all
smpl @first @first
Code: Select all
smpl @first+1 @last
Code: Select all
series trend0 = @recode(xyc=1, trend0(-1), trend0(-1)+1)
Re: Series manipulation
Thank you again for a solution and explanation!
Regards from far far away :D
Regards from far far away :D
Who is online
Users browsing this forum: No registered users and 2 guests
