m.pdf

(6869 KB) Pobierz
MATA REFERENCE MANUAL
RELEASE 11
A Stata Press Publication
StataCorp LP
College Station, Texas
799312779.051.png 799312779.062.png 799312779.063.png 799312779.064.png 799312779.001.png 799312779.002.png 799312779.003.png 799312779.004.png 799312779.005.png 799312779.006.png 799312779.007.png 799312779.008.png 799312779.009.png 799312779.010.png 799312779.011.png 799312779.012.png 799312779.013.png 799312779.014.png 799312779.015.png 799312779.016.png 799312779.017.png 799312779.018.png 799312779.019.png 799312779.020.png 799312779.021.png 799312779.022.png 799312779.023.png 799312779.024.png 799312779.025.png 799312779.026.png 799312779.027.png 799312779.028.png
Copyright c 1985–2009 by StataCorp LP
All rights reserved
Version 11
Published by Stata Press, 4905 Lakeway Drive, College Station, Texas 77845
Typeset in T E X
Printed in the United States of America
10
9
8
7
6
5
4
3
2
1
ISBN-10: 1-59718-056-4 (volumes 1–2)
ISBN-10: 1-59718-057-2 (volume 1)
ISBN-10: 1-59718-058-0 (volume 2)
ISBN-13: 978-1-59718-056-6 (volumes 1–2)
ISBN-13: 978-1-59718-057-3 (volume 1)
ISBN-13: 978-1-59718-058-0 (volume 2)
This manual is protected by copyright. All rights are reserved. No part of this manual may be reproduced, stored
in a retrieval system, or transcribed, in any form or by any means—electronic, mechanical, photocopy, recording, or
otherwise—without the prior written permission of StataCorp LP unless permitted by the license granted to you by
StataCorp LP to use the software and documentation. No license, express or implied, by estoppel or otherwise, to any
intellectual property rights is granted by this document.
StataCorp provides this manual “as is” without warranty of any kind, either expressed or implied, including, but
not limited to, the implied warranties of merchantability and fitness for a particular purpose. StataCorp may make
improvements and/or changes in the product(s) and the program(s) described in this manual at any time and without
notice.
The software described in this manual is furnished under a license agreement or nondisclosure agreement. The software
may be copied only in accordance with the terms of the agreement. It is against the law to copy the software onto
DVD, CD, disk, diskette, tape, or any other medium for any purpose other than backup or archival purposes.
The automobile dataset appearing on the accompanying media is Copyright c 1979 by Consumers Union of U.S.,
Inc., Yonkers, NY 10703-1057 and is reproduced by permission from CONSUMER REPORTS, April 1979.
Stata and Mata are registered trademarks and NetCourse is a trademark of StataCorp LP.
Other brand and product names are registered trademarks or trademarks of their respective companies.
For copyright information about the software, type help copyright within Stata.
The suggested citation for this software is
StataCorp. 2009. Stata: Release 11 . Statistical Software. College Station, TX: StataCorp LP.
799312779.029.png 799312779.030.png 799312779.031.png 799312779.032.png 799312779.033.png 799312779.034.png 799312779.035.png 799312779.036.png 799312779.037.png 799312779.038.png 799312779.039.png 799312779.040.png 799312779.041.png 799312779.042.png 799312779.043.png 799312779.044.png 799312779.045.png 799312779.046.png 799312779.047.png 799312779.048.png 799312779.049.png 799312779.050.png
i
Brief contents
[M-0] Introduction to the Mata manual
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
[M-1] Introduction and advice
[M-2] Language definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
[M-3] Commands for controlling Mata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
[M-4] Index and guide to functions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
[M-5] Mata functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
[M-6] Mata glossary of common terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
iii
Table of contents
[M-0] Introduction to the Mata manual
intro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction to the Mata manual
3
[M-1] Introduction and advice
intro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction and advice
11
ado
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Mata with ado-files
13
first
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction and first session
20
help
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Obtaining online help
35
how
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How Mata works
36
interactive
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Mata interactively
41
LAPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The LAPACK linear-algebra routines
49
limits
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Limits and memory utilization
50
naming
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Advice on naming functions and variables
52
permutation . . . . . . . . . . . . . . . . . . . . . . . . . . .
An aside on permutation matrices and vectors
55
returnedargs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Function arguments used to return results
61
source
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Viewing the source code
64
tolerance
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use and specification of tolerances
65
[M-2] Language definition
intro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Language definition
71
break
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Break out of for, while, or do loop
73
class
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Object-oriented programming (classes)
74
comments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comments
98
continue
. . . . . . . . . . . . . . . . . . . . . . .
Continue with next iteration of for, while, or do loop
100
declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Declarations and types
102
do
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
do ::: while (exp)
111
errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error codes
112
exp
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Expressions
117
for
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
for (exp1; exp2; exp3) stmt
123
ftof
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Passing functions to functions
125
goto
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
goto label
127
if (exp) ::: else ::: 129
if
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
op arith . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Arithmetic operators
131
op assignment
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Assignment operator
133
op colon
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Colon operators
138
op conditional
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conditional operator
141
op increment
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Increment and decrement operators
143
op join
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Row- and column-join operators
146
op kronecker
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Kronecker direct-product operator
149
op logical
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Logical operators
151
op range
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Range operators
154
op transpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conjugate transpose operator
156
optargs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optional arguments
159
pointers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pointers
164
pragma
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Suppressing warning messages
175
799312779.052.png 799312779.053.png 799312779.054.png 799312779.055.png 799312779.056.png 799312779.057.png 799312779.058.png 799312779.059.png 799312779.060.png 799312779.061.png
 
Zgłoś jeśli naruszono regulamin