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
Chiara Mussida <firstname.lastname@example.org>
Re: st: mat list
Tue, 10 Apr 2012 14:50:30 +0200
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 <email@example.com> 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/
Doctoral school of Economic Policy
Catholic University, Piacenza (Italy)
* For searches and help try: