Statalist


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

st: How does one export Mata matrices to Stata matrix language matrices?


From   "Petroulas Pavlos" <[email protected]>
To   <[email protected]>
Subject   st: How does one export Mata matrices to Stata matrix language matrices?
Date   Fri, 26 Oct 2007 12:32:29 +0300

Dear all, 

My question is the following. If I am in Stata and for memory preserving
reasons I enter Mata (instead of using Stata's matrix language) do
certain matrix operation, I would then like to exit Mata but keep the
matrices in Stata's memory: How do I do this? (I.e with mat dir in
Statas matrix language I would like for some matrices that I've created
in Mata to show up)

Here follows an example that might be a bit more illuminating than my
question

*load a weighting matrix

	use A.dta, replace


* Enter it to Mata and do some matrices

	mata 
		st_view(A=., ., .)

		NS=50
		T=11
		NT=NS*T

		IM=I(NS)
		TM=I(T)
		JM=J(T,T,1/T)

		B=(TM-JM)#IMAT
		C=JM#IM

	end

*drop the weighting matrix

	drop A1-A50

*load the variables enter them into Mata do the matrix calculations

	use D.dta, replace

	mata 
		st_view(y=.,., "y")			(Equivalent to
mkmat?)
		st_view(x1=.,., "x1")
		st_view (x2=., .,("x2"))
		st_view (x3=., .,("x3"))

		x1sc=x1[1]


	`	E=TM#(IM- x1sc *A)

		Y1=E*y
		x22=E*x2
		X33=E*x3

		F= B + C

		Y11=F*y1
		X222=F*x22
		X333=F*x33

end


Here I would like to export 
1	the variables y11, x222, x333 to Stata (something equivalent to
svmat but from Mata to Stata)
2 	the matrices E & F	in such a way that if I write ' mat dir'
in Stata E & F appear in the  memory. If this is not possible what would
you recommend?


Kina regards, 


Pavlos 


 

==============================================================================================================
Με την επιφύλαξη παντός νομίμου δικαιώματός μας. Κάθε μήνυμα ηλεκτρονικού ταχυδρομείου από την Τράπεζα της Ελλάδος (ΤτΕ) αποστέλλεται καλόπιστα αλλά δεν τη δεσμεύει ούτε ερμηνεύεται ως να συνιστούσε ή επηρέαζε συμβατική ή άλλη δέσμευση της ΤτΕ.
Το μήνυμα ηλεκτρονικού ταχυδρομείου προορίζεται προς αποκλειστική χρήση του προσώπου, του οποίου η διεύθυνση αναγράφεται στην επικεφαλίδα του μηνύματος. Ο αποστολέας και η ΤτΕ δεν αναλαμβάνουν καμμία ευθύνη για ανακρίβειες, παραβίαση της ακεραιότητας, απώλεια ή καθυστερημένη διαβίβαση του μηνύματος, για αστοχία, διακοπή ή υποβάθμιση της υπηρεσίας ή του μηνύματος καθώς και για κάθε εξ αυτού του λόγου απώλεια ή ζημία καθόλη την υπό του νόμου προβλεπόμενη έκταση.
Εάν λάβατε κατά λάθος το παρόν μήνυμα ηλεκτρονικού ταχυδρομείου, παρακαλούμε να ειδοποιήσετε αμέσως μέσω ηλεκτρονικού ταχυδρομείου τον αποστολέα και να διαγράψετε το μήνυμα. Οποιαδήποτε ανακοίνωση, διάδοση ή χρήση μέρους ή ολόκληρου του μηνύματος χωρίς άδεια απαγορεύεται αυστηρά και μπορεί να επιφέρει ποινική και αστική ευθύνη.

Any e-mail message from the Bank of Greece (BoG) is sent in good faith but shall neither be binding nor construed as constituting or affecting a contractual arrangement or other commitment by the BoG.
The e-mail is intended for the exclusive use of the person whose e-mail address appears in caption as recipient. The sender and the BoG decline liability for inaccuracy, breach of integrity, loss or delayed delivery of the message, for any failure in, interruption to or degradation of either the service or the message, as well as for any loss or damage sustained thereof to the fullest extent provided by law.
If you have received this e-mail in error, please notify the sender immediately via e-mail and delete it at once. Any unauthorized disclosure, dissemination or use, either in whole or in part is strictly prohibited and may give rise to both criminal and civil liability. All rights reserved.
==============================================================================================================



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