Ho to create a subgroup from a global group

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

psp41
Posts: 4
Joined: Tue Feb 15, 2011 2:58 am

Ho to create a subgroup from a global group

Postby psp41 » Thu Feb 17, 2011 5:54 am

Hello,
I have created a (global) group with 310 variables. I would like to estimate a stepwise regression based on this grlobal group but I have too much variables in my (global) group for the estimation.

So, I would like to create K subgroup (with maximum 30 variables in each K subgroup) and each variables should be extracted from a random draws from the global group . I don't know how to program it? Do you have a solution? Thanks a lot

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: Ho to create a subgroup from a global group

Postby EViews Gareth » Thu Feb 17, 2011 9:07 am

Here's a bit of code that creates a workfile with 310 variables in it, puts them in a group, called G, then creates another group, called G3, that has a random selection of 30 of those variables.

Code: Select all

create u 100 group g for !i=1 to 310 series x!i=nrnd g.add x!i next copy g g2 'make a copy of the group group g3 for !i=1 to 30 !rand = @floor((g2.@count*@rnd))+1 'generate a random number %name = g2.@seriesname(!rand) 'select the series from the group g3.add {%name} 'add it to group 3 g2.drop {%name} 'drop it from group 2 (to avoid replacement issues) next

psp41
Posts: 4
Joined: Tue Feb 15, 2011 2:58 am

Re: Ho to create a subgroup from a global group

Postby psp41 » Fri Feb 18, 2011 12:46 am

thanks a lot for your help !!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest