Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: RE: st: AW: Problem creating large matrices


From   "Achilleas Vassilopoulos" <axivas@yahoo.gr>
To   <statalist@hsphsun2.harvard.edu>
Subject   FW: RE: st: AW: Problem creating large matrices
Date   Tue, 13 Jul 2010 10:42:18 +0300

Thanks Martin, indeed it seems much easier with -postfile-, haven't thought
of that. 
The example I've posted was just to give you an idea of what I'm trying to
do. My code is much more complex and of course returns different results in
every iteration (I just didn't want to overwhelm the list with my original
code). Thanks a lot for your help.

Best, 
_____________ - _______________

Achilleas Vassilopoulos

Agricultural University of Athens,
Dept. of Agricultural Economics and Rural Development,
Lab. of Political Economy and European Integration.
Iera Odos 75, 11855, Athens, Greece

Tel: (+30) 210-5294726
Fax: (+30) 2105294786
e-mail:avassilopoulos.aua@gmail.com

-----Original Message-----

This is much more easily done using -postfile-. I am baffled, though, what
your research question is: Your -regress-ion will yield identical results
for all 160,000 iterations. Not worth the wait, I guess...


***********
sysuse auto, clear
 
capture erase info.dta
tempname hdle
postfile `hdle' b_weight se_weight using info
 
qui forv i=1/160{
 	reg price weight length trunk
 	post `hdle' (_b[weight]) (_se[weight])
}
 
postclose `hdle'

use info, clear
 
l, noo h(20)

su b_weight se_weight
***********


HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Achilleas
Vassilopoulos
Sent: Montag, 12. Juli 2010 20:46
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: AW: Problem creating large matrices

Dear Martin,

Thank you for your immediate response. I want to save the results in a
matrix so then I can 'svmat' them and take mean and SE of my estimation.
Your mata command seems to work perfectly in creating this huge matrices but
since I'm not at all familiar with mata I have 2 additional question to you
and who else knows: 

1) If I'm able to use the 'svmat' command in matrices created in mata?
2) how can I assign r() or e() values to the rows of such matrices

To give a very naive example of what I want to estimate, consider that I'm
interested on the mean (avgbeta) and the SE (bse) of the beta coefficients
of  a simple regression ran 160000, my code would be :

matrix beta = J(160000,1,0)

forvalues i=1/160000 {

reg y x
matrix beta [`i',1] = e(b)
}

svmat beta
qui sum beta1
local avgbeta = r(mean)
local bse = r(sd)
 
_____________ - _______________

Achilleas Vassilopoulos

Agricultural University of Athens,
Dept. of Agricultural Economics and Rural Development,
Lab. of Political Economy and European Integration.
Iera Odos 75, 11855, Athens, Greece

Tel: (+30) 210-5294726 begin_of_the_skype_highlighting              (+30)
210-5294726      end_of_the_skype_highlighting
Fax: (+30) 2105294786
e-mail: avassilopoulos.aua@gmail.com

-----Original Message-----
>From 	  "Martin Weiss" <martin.weiss1@gmx.de>
To 	  <statalist@hsphsun2.harvard.edu>
Subject 	  st: AW: Problem creating large matrices
Date 	  Mon, 12 Jul 2010 14:54:16 +0200
Try -mata- then:

*************
clear*
mata
beta = J(160000,1,0)
mata des
end
*************


Why do you need to collect results in a -matrix-? I have never felt the urge
to do that, which could be entirely my fault, but let`s see whether we can
solve your problem more elegantly.


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Achilleas
Vassilopoulos
Gesendet: Montag, 12. Juli 2010 14:42
An: statalist@hsphsun2.harvard.edu
Betreff: st: Problem creating large matrices

Dear all,

I need to save the results of multiple estimations in a matrix. My
simulation produces 160,000 such results but when I?m trying to create a
matrix containing 160,000 rows with the following command: matrix beta = J
(160000,1,0), I get the following warning : 

Matsize too small
You have attempted to create a matrix with more than 11000 rows or columns
or to fit a model with more than 11000 variables plus ancillary parameters. 
You need to increase matsize using the set matsize command; see help
matsize.

However, the ?set matsize? command doesn?t accept numbers greater than
11,000.

Does anyone know if there is another command to create the matrices which
doesn?t fall into the matsize limitations or any other way to circumvent
this problem?

Thanking you in advance,
_____________ - _______________

Achilleas Vassilopoulos

Agricultural University of Athens,
Dept. of Agricultural Economics and Rural Development,
Lab. of Political Economy and European Integration.
Iera Odos 75, 11855, Athens, Greece

Tel: (+30) 210-5294726 begin_of_the_skype_highlighting              (+30)
210-5294726      end_of_the_skype_highlighting
Fax: (+30) 2105294786
e-mail: avassilopoulos.aua@gmail.com 





*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index