Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: matrix - how to copy row names into data?


From   "Ada Ma" <[email protected]>
To   [email protected]
Subject   Re: st: matrix - how to copy row names into data?
Date   Tue, 31 Jul 2007 13:02:05 +0100

Hi Nick,

Thanks a lot for the reply.  I didn't find your email until today.  I
just wanted to thank you for giving me suggestions on what to do.

As for what I was doing - I wanted to store the coeff and t-stats of
regressions with the explanatory variables in a data set.  I was
estimating the same equation a 1000 times with a 50% random draw, save
the coeffs/t-stats, then make out of sample predictions and save the
sum stats of the out of sample predictions.  The end product I was
looking for was two data sets, one with 1000 sets of coeffs and
t-stats, another one with 1000 sets of out-of-sample predictions
summary statistics.  I was doing this on three types of geographies -
you might recall back in 2006 I was looking for ways to test which
geography best define the UK labour market - this is what we decided
to do (it's a group project, we choose the one that makes the best
out-of-sample predicts, as expected it's the LADs as it has the finest
mesh).  I wrote a loop that loop through the three geographies (LAD,
TTWA, health geog), and then loop through the commands for doing
regression / save results / make predictions / calculate sum stats /
save sum stats a 1000 times.

To say it simply I was bootstrapping, but I created the first do file
a while back under tight deadlines and I was feeling a bit scared of
the bootstrapping commands, plus knowing that it would take long time
to run I did not dare to spend too much time to explore (took 10 days
on 3 PCs).  Now I am re-doing it at leisure, with the sunk cost I am a
bit lazy to move on to bootstrap... :-P

So that's my story.  Thanks for listening and thanks again for your
suggestions!!  I will take a look at the svmat2 and see what it does.

Cheers,
Ada




On 7/16/07, n j cox <[email protected]> wrote:
> An option for doing this was one of the features
> of an -svmat2- published in STB-56 in 2000, in
> Stata terms a long time ago.
>
> In Stata 10,
>
> . search svmat
>
> will not reveal this publication. You have
> to push hard:
>
> . search svmat, historical
>
> reveals the StataCorp judgement that you should be
> using Mata instead. However, StataCorp have not
> marked their own command -svmat- as historical,
> so we have the interesting anomaly that -svmat-
> is well documented, but not a command that improves
> upon it, at least by adding handles. In the document
> -njc_stuff.hlp- available from SSC I annotate the module
> in question as partially obsolete given Mata, so that's
> my judgement compared with the official one.
>
> Anyway, -svmat2- is a solution to your problem, but StataCorp
> have made it more difficult for you to find that out.
> They may be right that you should be using Mata
> instead, but without context no judgment on that is
> possible.
>
> Nick
> [email protected]
>
> Ada Ma asked
>
> I have a matrix:
>       A1
> A1  x
> B2  x
> C3  x
>
>
> The x's are the numbers, I can svmat them into data without any
> problem, but I want to copy the names of the rows (A1, B2, C3) into
> the data as well (so that I can export the rownames as well as the
> numbers into a CSV file).  How do I do that?
>
> I know I can store the rownames into a local and then stick the
> rownames into the data one by one, but I think there must be faster
> neater ways to do that.  All suggestions welcomed!
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index