Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: mat list
Maarten Buis <firstname.lastname@example.org>
Re: st: mat list
Tue, 10 Apr 2012 15:21:46 +0200
I would look at -help estimates- and use -estimates store- and
-estimates restore-. If your problem is too complicated for that than
it will certainly be so complicated that the probability of a hard to
find bug is (near) 100% when referring to coefficients by column
If you decide to use scalars, than don't forget to use -tempname-s for
them (variables and scalars share the same namespace, and this can
cause problems), see the manual entry for -scalar-.
On Tue, Apr 10, 2012 at 2:50 PM, Chiara Mussida <email@example.com> wrote:
> for the calculations i have to use coef from different models, that's
> why i need to store them in separate matrices and not only store and
> work on the last model estimates. For each of my reg k will create a
> different mat with obviously a diff name and thereafter i will play
> with coef. Do you think it is more deficient to save them as scalars
> with more simple name than b[row, col ]?
> On 10/04/2012, Maarten Buis <firstname.lastname@example.org> wrote:
>> On Tue, Apr 10, 2012 at 12:33 PM, Chiara Mussida wrote:
>>> i run a reg and i need to use the coefficients for calculations purposes.
>>> After my reg i gen a matrix with my betas:
>>> mat beta=e(b)
>>> this is a 1*k vector of coef.
>>> To use them for my manipulation is it enough to refer to them- such:
>>> beta[1,col] or it is better to gen a scalar for each matrix element?
>> I have programmed quite a bit of post-estimation commands and I have
>> never been in a situation where I had to refer to coefficients by
>> column number. That seems to me an extremely bug-prone method.
>> I find it often convenient to refer to specific coefficients as
>> -_b[varname]-. This is mainly because it is easier to see in your code
>> what coefficient you refer to, so the code becomes easier to read and
>> debug. This trick does not require that you store your coefficients in
>> a separate matrix, but it does refer to the currently active model
>> (which you can manipulate using -est store- and -est restore-).
>> Hope this helps,
>> Maarten L. Buis
>> Institut fuer Soziologie
>> Universitaet Tuebingen
>> Wilhelmstrasse 36
>> 72074 Tuebingen
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/statalist/faq
>> * http://www.ats.ucla.edu/stat/stata/
> Chiara Mussida
> PhD candidate
> Doctoral school of Economic Policy
> Catholic University, Piacenza (Italy)
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
Maarten L. Buis
Institut fuer Soziologie
* For searches and help try: