Search found 14 matches

by b_lobo
Thu Sep 04, 2014 12:33 pm
Forum: Data: Reading, Writing, Transforming
Topic: Unbalanced panel data
Replies: 5
Views: 10833

Re: Unbalanced panel data

This is a small sample from a bigger file. There are other cross sections that start at event #1. For firms that don't have obs for event #1, I'd like the missing obs code to show. No firm in the entire file has all 191 obs, so I expect that all the cross sections will have some missing obs. I'm set...
by b_lobo
Thu Sep 04, 2014 8:18 am
Forum: Data: Reading, Writing, Transforming
Topic: Unbalanced panel data
Replies: 5
Views: 10833

Re: Unbalanced panel data

Thank you. Doing this generates 163 obs for firms 1, 2 and 3 but only 56 obs for firm 4. Also the start event for each firm is different. I'm trying to get all the firms to start with event #1 and end with event #191 i.e. a total of 4 x 191 = 764 rows of data including missing obs. Any thoughts?
by b_lobo
Wed Sep 03, 2014 1:38 pm
Forum: Data: Reading, Writing, Transforming
Topic: Unbalanced panel data
Replies: 5
Views: 10833

Unbalanced panel data

I am trying to create a balanced panel dataset. Attached is a sample XLS file with 4 cross-sections or firms. The total time periods should be 191 months from 1998:6 through 2014:4. Thus I need a balanced panel of 4 x 191 = 764 obs. The data are stacked by firm and each firm has is indexed by "...
by b_lobo
Fri Sep 13, 2013 6:24 pm
Forum: Help With Programming
Topic: parsimonious representation
Replies: 2
Views: 6034

Re: parsimonious representation

I need each draw (i.e. a unique combination) to cycle through 30 quarters. Nesting the j loop inside the draw loop became necessary when I was using %ranpermute so as to preserve the same combination through all 30 qtrs. I guess I could nest the draw loop inside the j loop if I use a set number of c...
by b_lobo
Fri Sep 13, 2013 1:42 pm
Forum: Help With Programming
Topic: parsimonious representation
Replies: 2
Views: 6034

parsimonious representation

Two questions related to a portion of code below: 1. How would I write the constraints and compute statements parsimoniously using perhaps %dot(A,B)? I've tried %dot(w(i),bx(n(i)))==z, but that doesn't seem to be right 2. How can I generate statistics on the series PRETZB, PBETAZB and PDURZB by &quo...
by b_lobo
Sat Sep 07, 2013 10:04 am
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

Yep - my data was in columns. Got it sorted out - thanks!!
by b_lobo
Sat Sep 07, 2013 9:07 am
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

My mistake: I took the (10) in the dec statement to be the dimension of each vector. So the dec vect[index] is tracking all the 252 vectors of combinations, right? I'm expecting RATS to sequentially pull each vector into the code after it reads the combos. However, the write instruction gives me som...
by b_lobo
Fri Sep 06, 2013 8:14 pm
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

This set of instructions gives me: ## MAT18. You Must Dimension the Outer Array Separately dec vect[index] mycombos(10) do i=1,252 dim mycombos(i)(10) end do i open data combinations.xls read(format=xls) mycombos Also, will I follow this up with something like: do draw=1,252 compute n = mycombos(i) ...
by b_lobo
Fri Sep 06, 2013 1:15 pm
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

I have all the 252 combinations of 10 in a separate data sheet. What would be the best way to map those into the code below instead of %ranpermute(10)? compute n = %ranpermute(10) do j=1,30 dec vect bx(10) dx(10) rx(10) ; * there are 10 cross-sections (x) ewise bx(i) = b(i+(10*(j-1))) ewise dx(i) = ...
by b_lobo
Tue Sep 03, 2013 12:01 pm
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

I have been using %ranpermute(10). However, it is possible to get in one draw 1,2,3,4,5 but in a second draw 1,3,2,4,5 for the first or last five securities. The securities are the same but ordered differently. I'm trying to avoid this. I'd like to have at least one number different in each draw, sa...
by b_lobo
Tue Sep 03, 2013 10:56 am
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

I should add the 2 sets of 5 must be distinctly different numbers from 1 to 10.
by b_lobo
Tue Sep 03, 2013 10:54 am
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

compute n1 = %rancombo(10,5)
compute n2 = %rancombo(10,5)
display @20 n1(1) @25 n1(2) @30 n1(3) @35 n1(4) @40 n1(5) @45 n2(1) @50 n2(2) @55 n2(3) @60 n2(4) @65 n2(5)

gave me: 5 9 3 2 4 || 6 3 2 7 5

The 3,2 and 5 got repeated. Perhaps I'm not coding this correctly?
by b_lobo
Tue Sep 03, 2013 10:34 am
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Re: Random combination of 5 from 10

To be clear, say, in the first draw I get draw=1 1,2,3,4,5 6,7,8,9,10 then, in the second draw at least one of the 1,2,3,4,5 needs to be different and (automatically) one of the 6,7,8,9,10 needs to be different. If I run %rancombo(10,5) twice, then the second %rancombo could draw a security that was...
by b_lobo
Mon Sep 02, 2013 9:22 pm
Forum: Help With Programming
Topic: Random combination of 5 from 10
Replies: 15
Views: 19696

Random combination of 5 from 10

I'm looking to create random sets of 2 portfolios of 5 securities each such that for each set the portfolios have at least one different security. The ordering of the securities does not matter. In other words, this is a10C5 combination problem. Any thoughts on how to code this? %ranpermute(10) does...