The example computes a correlogram twice, once using the library function, and once `manually' (in the matrix macf).
1.0000 1.0000 1.0000 1.0000
-0.0021973 -0.046870 -0.0021973 -0.046870
-0.041011 -0.051470 -0.041011 -0.051470
-0.050879 -0.039346 -0.050879 -0.039346
0.056525 -0.093980 0.056525 -0.093980
0.021034 0.12671 0.021034 0.12671
1.5708 0.00000
0.00000 1.5708
0.00000 0.78540
1.0000 0.54030
1.0000 1.5431
0.00000 0.84147
0.00000 1.1752
0.00000 1.5574
0.00000 0.76159
5.0000 15.000
5.0000 40.000
5.0000 65.000
5.0000 90.000
6.0000 21.000
6.0000 57.000
6.0000 93.000
2.0000 39.000
5.0000 5.0000 5.0000 5.0000
15.000 40.000 65.000 90.000
6.0000 6.0000 6.0000 2.0000
21.000 57.000 93.000 39.000
Running the following arglist.ox program:
argument 0: arglist.ox integer value:0
argument 1: aa integer value:0
argument 2: 12 integer value:12
The array cast can be useful when an array indexation must remain an array. For example, a single index on an array of strings returns a string, whereas a multiple index returns an array of strings:
single index is string: ax multiple index is array of strings: [0] = ax [1] = bx keep single index as array: [0] = ax
1.0000 -1.0000 -2.0000
1.0000 1.0000 0.00000
0.00000 1.0000 1.4142
1.0000 1.4142 1.4142
1.0000 1.0000 1.0000
0.00000 0.00000 0.00000
1.0000 0.00000 -2.0000
0.00000 2.0000 0.00000
1.0000 1.0000 1.0000
0.00000 0.00000 0.00000
1.0000 1.0000 8.6593e-017
0.00000 1.0000 1.4142
In the second example the complex functions are used to check if the computed roots of a polynomial indeed correspond to zeros of the polynomial:
roots
0.82865 0.82865 -0.39337 -0.036535
0.16923 -0.16923 0.00000 0.00000
inverse roots
1.1585 1.1585 -2.5422 -27.371
-0.23659 0.23659 0.00000 0.00000
check (near-zeros could be different with other Ox versions):
0.00000 0.00000 -1.7000e-016 -8.4441e-018
-2.2204e-016 2.2204e-016 0.00000 0.00000
The final example considers the complex logarithm:
z clog(z)
-1.0000 0.00000
-0.00000 -3.1416
-1.0000 0.00000
0.00000 3.1416
1.0000 0.00000
-0.00000 -0.00000
1.0000 0.00000
0.00000 0.00000
clog(z_1z_2)clog(z_1)+clog(z_2)
1.6094 1.6094
-1.5708 4.7124
ph(z_1)=2.67795 ph(z_2)=2.03444
-1.0000 -1.0000 2.0000 2.0000
-2.0000 -2.0000 1.0000 1.0000
-2.0000 -1.0000 1.0000 2.0000
-1.0000 -1.0000 1.0000 1.0000
-1 -1 1 1
The example also shows how solvelu may be used to obtain P^-1.
2.0000 0.00000
0.500000 1.6583
4.0000 1.0000
1.0000 3.0000
0.50000 0.00000 0.50000 0.00000
-0.15076 0.60302 -0.15076 0.60302
2 6 3 6 6 6
1.5000 1.5000
1.5000 1.5000
1.0000 -0.039218
-0.039218 1.0000
1.0000 -0.039218
-0.039218 1.0000
3.0000 2.0000 1.0000 0.00000
0.00000 1.0000 2.0000 2.0000
0.00000 0.00000 0.00000 1.0000
3.0000 1.0000
2.0000 2.0000
1.0000 3.0000
1.0000 1.0000 1.0000 2.0000 2.0000
1.0000 1.5000 2.0000 4.0000 2.0000
1.0000 1.7500 3.5000 8.0000 8.0000
1.0000 1.8750 5.5000 16.000 32.000
1.0000 1.9375 8.2500 32.000 512.00
1.0000 1.5000 1.7500 2.7500 3.7500
1.0000 1.0000 1.0000 1.0000 1.0000
1.0000 2.0000 1.5000 2.0000 2.0000
1.0000 3.0000 1.7500 3.5000 3.5000
1.0000 4.0000 1.8750 5.5000 5.5000
1.0000 5.0000 1.9375 8.2500 8.2500
1-Jan-2000 was weekday 7 (7 is Saturday)
1-Jan-2000 was yearday 2451545
2000 had 366 days
2001 had 365 days
Easter Sunday Last Wed in May
2005-03-27 2005-05-30
2006-04-16 2006-05-29
2007-04-08 2007-05-28
2008-03-23 2008-05-26
2009-04-12 2009-05-25
2010-04-04 2010-05-31
today 2012-11-28
result = 1 L =
1.0000 0.00000
0.25000 1.0000
D =
0.25000 0.36364
4.0000 1.0000
1.0000 3.0000
1.0000 0.00000
0.00000 1.0000
original matrix
5.0000 4.0000 3.0000 0.00000 0.00000
4.0000 6.0000 4.0000 3.0000 0.00000
3.0000 4.0000 7.0000 4.0000 3.0000
0.00000 3.0000 4.0000 8.0000 4.0000
0.00000 0.00000 3.0000 4.0000 9.0000
band version
0.00000 0.00000 3.0000 3.0000 3.0000
0.00000 4.0000 4.0000 4.0000 4.0000
5.0000 6.0000 7.0000 8.0000 9.0000
solved:
0.012378 0.26172 -0.036251 0.17507 0.48983
band L=
0.00000 0.00000 0.60000 1.0714 0.70000
0.00000 0.80000 0.57143 0.53333 0.67290
1.0000 1.0000 1.0000 1.0000 1.0000
L:U=
5.0000 4.0000 3.0000 0.00000 0.00000
0.80000 6.0000 4.0000 3.0000 0.00000
0.60000 0.57143 7.0000 4.0000 3.0000
0.00000 1.0714 0.53333 8.0000 4.0000
0.00000 0.00000 0.70000 0.67290 9.0000
3.0000 17.000 10.000
2.0000 4.0000 -2.0000
6.0000 18.000 -12.000
0.00000 1.0000 0.00000
0.00000 0.00000 1.0000
1.0000 0.00000 0.00000
1.0000 0.00000 0.00000
0.00000 1.0000 0.00000
0.00000 0.00000 1.0000
A=
2.0000 1.0000 4.0000
5.0000 1.0000 7.0000
8.0000 1.0000 9.0000
11.000 1.0000 12.000
QR
2.0000 1.0000 4.0000
5.0000 1.0000 7.0000
8.0000 1.0000 9.0000
11.000 1.0000 12.000
I
1.0000 0 0
0 1.0000 0.00000
0 0.00000 1.0000
A=
2.0000 1.0000 4.0000
5.0000 1.0000 7.0000
8.0000 1.0000 9.0000
11.000 1.0000 12.000
A'A
214.00 26.000 247.00
26.000 4.0000 32.000
247.00 32.000 290.00
R'R (ignoring pivoting)
290.00 247.00 32.000
247.00 214.00 26.000
32.000 26.000 4.0000
R'R (after undoing pivoting)
214.00 26.000 247.00
26.000 4.0000 32.000
247.00 32.000 290.00
Note that mp[0][] contains P':
1.0000 2.0000 0.00000
The pivots on A (where AP=QR) are:
2.0000 0.00000 1.0000
The example shows how to obtain Q', reconstructs the original matrix, and implements regression using the QR decomposition (note that olsc is also QR based). Because the input matrix is singular, the solution is not unique. Different versions of Ox may find different solutions depending on differences in accumulation of rounding errors.
Input matrix is singular
H'=
1.0000 0.00000 0.00000
0.30877 1.0000 0.00000
0.46316 -0.32710 1.0000
0.61755 -0.78925 0.46524
R1=
-16.432 -1.8257 -14.606
0.00000 -0.81650 0.81650
0.00000 0.00000 2.7577e-015
pivots
1.0000 2.0000 0.00000
2.0000 2.0000 2.0000
Q'=
-0.18257 -0.81650 0.54384 0.065078
-0.36515 -0.40825 -0.77363 0.31859
-0.54772 5.5511e-017 -0.084268 -0.83241
-0.73030 0.40825 0.31406 0.44874
ma (pivoted)=
3.0000 1.0000 2.0000
6.0000 1.0000 5.0000
9.0000 1.0000 8.0000
12.000 1.0000 11.000
ma=
1.0000 2.0000 3.0000
1.0000 5.0000 6.0000
1.0000 8.0000 9.0000
1.0000 11.000 12.000
regression coefficients (transposed)
0.50000 0.00000 0.23333
rank=
2.0000
from QR
0.23333 0.50000 0.00000
in correct order
0.50000 0.00000 0.23333
The example shows first how the QR decomposition of an upper Hessenberg matrix (a matrix with zeros below the subdiagonal) can be computed, and then updates after appending a column to a lower triangular matrix.
Upper Hessenberg matrix A
1.0000 2.0000 3.0000 4.0000 5.0000
1.0000 5.0000 6.0000 7.0000 8.0000
0.00000 1.0000 8.0000 9.0000 10.000
0.00000 0.00000 1.0000 11.000 12.000
triangular R:
1.4142 4.9497 6.3640 7.7782 9.1924
0.00000 2.3452 5.3300 5.7564 6.1828
0.00000 0.00000 6.4102 8.8637 9.9131
0.00000 0.00000 0.00000 9.7365 10.583
original:
1.0000 2.0000 3.0000 4.0000 5.0000
1.0000 5.0000 6.0000 7.0000 8.0000
0.00000 1.0000 8.0000 9.0000 10.000
0.00000 0.00000 1.0000 11.000 12.000
Column 0 changed:
1.4142 4.9497 6.3640 7.7782 9.1924
1.0000 2.3452 5.3300 5.7564 6.1828
1.0000 0.00000 6.4102 8.8637 9.9131
1.0000 0.00000 0.00000 9.7365 10.583
Made triangular:
2.2361 4.1793 9.2753 15.812 17.745
0.00000 3.5403 1.4789 -3.9779 -4.0002
0.00000 0.00000 4.6671 -0.80946 -0.78739
0.00000 0.00000 0.00000 -0.70954 -1.2216
original:
1.4142 4.9497 6.3640 7.7782 9.1924
1.0000 2.3452 5.3300 5.7564 6.1828
1.0000 3.8760e-016 6.4102 8.8637 9.9131
1.0000 3.8760e-016 8.6736e-018 9.7365 10.583
a
0.22489 1.7400 -0.20426 -0.91760
-0.67417 -0.34353 0.22335 -0.14139
-0.18338 0.68035 0.090558 -0.83328
0.81350 1.1174 0.31499 -0.50031
eigenvalues
-0.25959 -0.25959 -0.0046060 -0.0046060
1.3775 -1.3775 0.32694 -0.32694
s
-0.25959 -2.1654 -1.2665 -0.37296
0.87631 -0.25959 -0.51481 0.18777
0.00000 0.00000 -0.0046060 0.16910
0.00000 0.00000 -0.63214 -0.0046060
v*s*v'
0.22489 1.7400 -0.20426 -0.91760
-0.67417 -0.34353 0.22335 -0.14139
-0.18338 0.68035 0.090558 -0.83328
0.81350 1.1174 0.31499 -0.50031
cabs(eigenvalues) between 0 and 1 first, S=
-0.0046060 -0.20780 0.49340 0.64443
0.51441 -0.0046060 0.66321 0.24688
0.00000 0.00000 -0.25959 0.78487
0.00000 0.00000 -2.4177 -0.25959
b
-1.6268 0.61943 -1.4574 -1.8035
2.0016 0.57912 -0.70797 0.59336
-0.58939 1.4674 -0.020230 0.73706
1.4795 -0.26881 1.2282 1.5784
decschurgen i=0
alpha
1.9293 0.70758 -0.68938 -0.22323
beta
0.089639 3.2454 2.0066 1.7759
t
0.089639 0.68167 -0.46602 -0.52514
0.00000 3.2454 1.6897 -0.89339
0.00000 0.00000 2.0066 -0.75847
0.00000 0.00000 0.00000 1.7759
vl*t*vr'
-1.6268 0.61943 -1.4574 -1.8035
2.0016 0.57912 -0.70797 0.59336
-0.58939 1.4674 -0.020230 0.73706
1.4795 -0.26881 1.2282 1.5784
selecting gen. eigenvalues between 0 and 1 first
generalized eigenvalues
-0.0046060 -0.0046060 -0.25959 -0.25959
0.32694 -0.32694 1.3775 -1.3775
singular values:
9.5255 0.51430
result = 0 A =
1.0000 2.0000
3.0000 4.0000
5.0000 6.0000
A =
1.0000 3.0000 5.0000
2.0000 4.0000 6.0000
.NaN 1.0000 2.0000 3.0000
4.0000 5.0000 6.0000 7.0000
8.0000 9.0000 .NaN 11.000
Rows with .NaN deleted
4.0000 5.0000 6.0000 7.0000
deleter 4.0000 5.0000 6.0000 7.0000
deleteifr 8.0000 9.0000 .NaN 11.000
dfft
2.0000 0.50000 0.50000
0.00000 0.86603 -0.86603
fft1d
2.0000 0.50000 0.50000
0.00000 0.86603 -0.86603
inverse dfft(dfft))
1.0000 -1.4599e-016 1.0000
1.0000 0.00000
0.00000 1.0000
1.0000 0.00000
0.00000 1.0000
2.0000 2.0000 0.00000 0.00000
0.00000 0.00000 1.0000 0.00000
0.00000 0.00000 0.00000 1.0000
2 2 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 3 0 0
0 0 0 0 0 3 0
0 0 0 0 0 0 3
1 12 23
0 2 13 24
1 12 23 0
11 22 0 0
2.0000 0.00000 0.00000 0.00000
0.00000 2.0000 0.00000 0.00000
0.00000 0.00000 2.0000 0.00000
0.00000
0.00000
2.0000
2.0000
2.0000
In this example, the three intervals are [-3,-1), [-1,1) and [1,3). So the last observation of x will be ignored. The raw discretization simply counts the numbers in each interval, giving the first line of output. The weighted version looks at the distance to the points -2,0,2 (also printed as the last output line): -3 is to the left of the minimum, so fully assigned to the first interval. Apart from -1, all observations are exactly on a point, so fully assigned; -1 falls halfway between -2 and 0, so half is assigned to the first interval, and half to the second (if the value would have been -1.5, 0.75 would go to the first interval, 0.25 to the second.
2.0000 2.0000 1.0000
2.5000 1.5000 1.0000
-2.0000 0.00000 2.0000
1.0000 3.0000
4.0000 6.0000
1.0000 2.0000 3.0000
0.00000 1.0000 2.0000 3.0000
0.00000 4.0000 5.0000 6.0000
dropr(a, <1,2>)
[0][0] = A
[0][1] = B
a[0]=
[0] = A
[1] = B
dropr(a[0], <1>)
[0] = A
insertr(a[0], 0, 2)
[0] = .Null
[1] = .Null
[2] = A
[3] = B
result=0 eigenvalues:
3.6180 1.3820
eigenvectors:
-0.52573 0.85065
-0.85065 -0.52573
result=0 eigenvalues:
real 1.5000 1.5000
imaginary 1.6583 -1.6583
result = 0 generalized eigenvectors:
-0.52573 0.85065
-0.85065 -0.52573
exclusion -1 4 intersection -2 1 union -2 -1 1 3 4 union using unique -2 -1 1 3 4
1.0000 2.7183
1.1000 1.1000
2.0000 0.00000 2.0000 0.00000
0.00000 -0.00000 0.00000 0.00000
1.0000 0.00000 1.0000 -0.00000
before, x1=
4.0000 0.00000
0.00000 4.0000
3.0000 1.0000
x2=
4.0000 .NaN
3.0000 .NaN
2.0000 2.0000
1.0000 3.0000
0.00000 .NaN
vecindex - sorted indices (column):
0.00000
1.0000
4.0000
find returns the locations (column):
0.0000
4.0000
1.0000
can be used to insert the missing values in x2:
4.0000 0.00000
3.0000 1.0000
2.0000 2.0000
1.0000 3.0000
0.00000 4.0000
redo, but now with a value that is not found:
4.0000 0.00000
3.0000 1.0000
2.0000 2.0000
1.0000 3.0000
0.00000 4.0000
using find on: {"","aaz","baba","a","","a",6}
find first empty string: 0
find all empty strings: <0;-1;-1;-1;0;-1;-1>
find all that equal a: <0;-1;-1;-1;0;-1;-1>
find last that equals a: 5
find a in each string: <-1;0;1;0;-1;0;-1>
find strings ending in a: <-1;-1;3;0;-1;0;-1>
0.00000 10.000
1.0000 11.000
2.0000 .NaN
3.0000 13.000
.NaN .NaN
5.0000 .NaN
SAM_ALLVALID: t1=0 t2=1
SAM_ENDSVALID: t1=0 t2=3
SAM_ANYVALID: t1=0 t2=5
SAM_ALLVALID: t1=1 t2=3 column 0, lags 0-1
A number of input/output examples is in the samples/inout directory. The programs inout10 and inout11 show how data can be read and written in blocks.
The example (samples/inout/iotest2.ox) writes a file, and reads it twice. The first time, the string read is tinker123, but then reading gets stuck, because the word tailor can not be read is an integer, double or matrix. Failure to read the matrix dimension generates an error message. The second time, the file is read properly.
Next statement will print message: "load matrix: no matrix elements"
load matrix: no matrix elements
items read=1 s=tinker123 int=0 dbl=0 mat=0
items read=3 int=123 dbl=456.78 mat=
1.0000 0.00000
0.00000 1.0000
token string: GMM("a", 1.5, -3);
scanned using "%t": GMM a 1.5 -3
scanned using "%T":
[0] = GMM
[1] = GMM
[2] = 0
[0] = a
[1] = "a"
[2] = 1
[0] = 1.5
[1] = 1.5
[2] = 1
[0] = -
[1] = -
[2] = 2
[0] = 3
[1] = 3
[2] = 1
A number of input/output examples is in the samples/inout directory. The programs inout10 and inout11 show how data can be read and written in blocks.
0.949963 0.949963 0.999462 0.999462
Current folder = D:\Waste Current folder = D:\OxMetrics6\ox\include Files in folder: [0] = g2ox.ox [1] = oxgauss.ox [2] = ox_init.ox
1.0000 0.00000 1.0000 0.00000
0.00000 1.0000 0.00000 1.0000
AA^A=A:
Warning: invertgen: invertsym failed, proceeding with
generalized p.s.d. inverse
invertgen.ox (10): main
-1.4211e-014 -4.4409e-016 -1.4211e-014
-2.2204e-016 1.4211e-014 -2.2204e-016
-1.4211e-014 -4.4409e-016 -1.4211e-014
Warning: invertgen: matrix has reduced rank
invertgen.ox (11): main
-7.1054e-015 -6.6613e-016 -7.1054e-015
-8.8818e-016 3.5527e-015 -8.8818e-016
-7.1054e-015 -6.6613e-016 -7.1054e-015
These generalized inverses are different:
Choleski failed, so use SVD
0.014260 -0.0023020 0.014260
-0.0023020 0.049276 -0.0023020
0.014260 -0.0023020 0.014260
Using QR
0.057041 -0.0046039 0.00000
-0.0046039 0.049276 0.00000
0.00000 0.00000 0.00000
m1 is fuzzy equal to 1
m2 is *** not *** fuzzy equal to 1
1.0000 1.0000
1.0000 1.0000
m1 has *** no *** missing values
m2 has missing values
0.00000 1.0000 0.00000
0.00000 0.00000 1.0000
0.00000 0.00000 0.00000
m2
1.0000 .NaN 3.0000
4.0000 5.0000 .NaN
7.0000 8.0000 9.0000
rows with NaN deleted
7.0000 8.0000 9.0000
7.0000 8.0000 9.0000
0.00000 .NaN
0.00000 .NaN
1.0000 1.0000
2.0000 2.0000
3.0000 3.0000
0.00000 0.22489 1.7400
1.0000 -0.20426 -0.91760
2.0000 -0.67417 -0.34353
3.0000 0.22335 -0.14139
4.0000 -0.18338 0.68035
5.0000 0.090558 -0.83328
6.0000 0.81350 1.1174
column min -0.67417 -0.91760
column max 0.81350 1.7400
row index of min 2.0000 1.0000
row index of max 6.0000 0.00000
1.0000 0.00000
0.00000 1.0000
1.0000 0.00000
0.00000 1.0000
names
[0] = AA
[1] = BB
and a file called t.mat:
xlsx sheet 1:
{ {"some text,","and text",.Null,.Null},
{.Null,"12bb",.Null,0.5},
{2455628.25,.Null,.NaN,.Null},
{.Null,15.16,.Null,2455628}
}
date/time elements in sheet 1:
[1][3]=12:00:00
[2][0]=2011-03-07T06:00:00
[3][3]=2011-03-07
Check ismissing in cell 0,2: 1
Check isnan in cell 0,2: 0
Check ismissing in cell 2,2: 1
Check isnan in cell 2,2: 1
xlsx sheet 2:
{ {"some more",.Null},
{.Null,99.900000000000006},
{"in second sheet",.Null}
}
csv sheet:
{ {"some text,","and text",.Null,.Null},
{.Null,"12bb",.Null,0.5},
{2455628.25,.Null,.NaN,.Null},
{.Null,15.16,.Null,2455628}
}
Key for nodata.xlsx: 1: cell has a value, 0: cell is empty
1 1 0 0
0 1 0 1
1 0 1 0
0 1 0 1
0.00000 2.3026
0.00000 1.0000
0.00000 0.00000 1.3863 3.2958 5.5452
0.57236 0.00000 12.802
1.0000 0.00000 0.00000
1.0000 1.0000 0.00000
1.0000 1.0000 1.0000
1.0000 1.0000 1.0000
0.00000 1.0000 1.0000
0.00000 0.00000 1.0000
x =
11.000 12.000
10.000 15.000
maxc and maxcindex
11.000 15.000 0.00000 1.0000
minc and mincindex
10.000 12.000 1.0000 0.00000
The normal distribution N[mu,sigma^2] has central moments:
vspace1ex
[
mu_r=sf Eleft[X-sf EXright]^r=left
beginarrayll
0 & textif r is odd,
fracr!(r/2)!fracsigma^r2^r/2 & textif r is even.
endarray
right.
]
So the standard normal distribution has skewness
[
sqrtbeta_1=mu_3/mu_2^3/2=0,
]
and kurtosis
[
beta_2=mu_4/mu_2^2=3.
]
The exponential distribution exp(lambda) has moments about zero:
[
mu_r'=sf EX^r=fracr!lambda^r.
]
Therefore, when lambda=2, the mean is 1/2, the variance
1/2-1/4=1/4, etc.
moment ratios
normal exp(2)
T 10000. 10000.
mean -0.011605 0.49592
std.dev. 1.0033 0.50088
skewness 0.010556 1.9876
kurtosis 3.0314 8.4267
first 6 central moments
mean -0.011605 0.49592
variance 1.0066 0.25088
m3 0.010660 0.24976
m4 3.0713 0.53039
m5 0.13868 1.1581
m6 15.774 2.9434
.NaN .NaN
.NaN .NaN
1.0000 1.0000
0.00000 0.00000
0.00000 0.00000
0.00000 0.00000
0.00000 0.00000 0.00000
0.00000 0.00000 -1.0000
0.00000 1.0000 -0.00000
1.0000 0.00000 -0.00000
1.0992 0.98022 1.1068 0.95734 0.78966 1.0401 1.0992 1.1068 0.78966 0.98022 0.95734 1.0401 16.842 13.139 12.740 0.23380 -0.11726 -0.10967 13.139 15.095 11.872 -0.11726 0.24566 -0.098336 12.740 11.872 14.467 -0.10967 -0.098336 0.24639 1.0992 0.98022 1.1068 0.95734 0.78966 1.0401 16.842 13.139 12.740 0.23380 -0.11726 -0.10967 13.139 15.095 11.872 -0.11726 0.24566 -0.098336 12.740 11.872 14.467 -0.10967 -0.098336 0.24639
1.0000 1.0000 1.0000 1.0000
3.7646 4.2561
3.7646 4.2561
3.7646 4.2561
periodogram frequencies FFT
0.00000 0.00000 1.1253e-033
0.49542 0.41888 0.49542
0.060270 0.83776 0.060270
0.024741 1.2566 0.024741
0.16432 1.6755 0.16432
0.036133 2.0944 0.036133
0.019385 2.5133 0.019385
0.023846 2.9322 0.023846
0.00000 0.00000 0.023846
0.00000 0.00000 0.019385
0.00000 0.00000 0.036133
0.00000 0.00000 0.16432
0.00000 0.00000 0.024741
0.00000 0.00000 0.060270
0.00000 0.00000 0.49542
a(x)=a[0]+a[1]*x+a[2]*x^2; a(3)=-2.3
-1.9635 -0.57722
-1.9635 -0.57722
-1.96351 4.934802 -16.8288 97.40909
1.0000 -1.7000 0.6200 0.0900
1.0000 -0.8000 -0.1000 -0.0000 -0.0000
1.0000 -1.7000 0.6200 0.0900
1.0000 -0.8000 -0.1000 0.0000 0.0000
-1.0000 1.2274 -0.017197 -0.28369 -0.010280
roots
0.82865 0.82865 -0.39337 -0.036535
0.16923 -0.16923 0.00000 0.00000
inverse roots
1.1585 1.1585 -2.5422 -27.371
-0.23659 0.23659 0.00000 0.00000
polynomial
1.0000 -1.2274 0.017197 0.28369 0.010280
0.00000 0.00000 0.00000 0.00000 0.00000
col 1 col 2
row 1 1 0
row 2 0 1
x p
2.024 [0.42]
15.66 [0.16]
Lower diagonal:
10.585
3.1110 7.1178
array:{{"AAA",10.1,0.3333333333333333},"\\hline",{"XAAA",12.1}}
\begin{tabular}{ccc}
AAA& 10.10& 0.33\\
\hline
XAAA& 12.10\\
\end{tabular}
In the second example we show the output from the "%v" format.
object using %v:
::VClass
{
.m_mMatrix = <1,2,3>;
.m_aArray = {"a","b","c"};
}
chi: 0.00000 0.90024 0.94996 normal: 0.024998 0.50000 0.97500 t: 0.060777 0.50000 0.93922 chi: 0.94996 0.88790 0.80010 chi: 0.95021 0.92810 0.90842 nc chi: 0.00000 0.37210 0.49621 nc t: 7.3581e-010 2.8665e-007 0.0052148
0.00000 6.0000 24.000 60.000
0.00000
24.000
120.00
0.5 1 0.253817018 -0.8
0.855154194 2 0.3047166335 -0.6
0.9510726929 3 0.3639172365 -0.4
0.98041856 4 0.4299859958 -0.2
0.9910499384 5 0.5 0
0.9954702686 6 0.5700140042 0.2
0.9975177199 7 0.6360827635 0.4
0.9985507194 8 0.6952833665 0.6
0.99910908 9 0.746182982 0.8
0.9994284475 10 0.7886751346 1
1.7500
2.5000
3.2500
2.5000
0.83516 1.2728 1.6457 1.9635
0.84842 1.2740 1.6248 1.9570
0.83516 0.84842
1.2728 1.2740
1.6457 1.6248
1.9635 1.9570
0.83536 1.2734 1.6459 1.9638
0.84871 1.2744 1.6255 1.9585
1.0000 2.0000 3.0000 4.0000
4.0000 3.0000 2.0000 1.0000
1.0000 3.0000 5.0000
1.2000 2.2000 3.2000
1.0000 3.1000 5.2000
-0.035817
0.22489 1.7400 -0.20426 -0.91760 -0.67417
0.22489 1.7400 -0.20426 -0.91760 -0.67417
RNG=MWC_52 initial seeds: 1013904223 ... 362436
0.0011722 -0.0070313
-0.0024659 -0.0065795
current seed: 866497328 ... 759508397
0.0011722 -0.0070313
RNG=GM initial seed:
[0] = 362436069
[1] = 521288629
-0.0046842 0.015912
0.0037562 0.017064
-0.0046842 0.015912
0.56444 0.76994 0.41641
0.15881 0.098209 0.37477
4.0000 1.0000 1.0000 2.0000
aAaAxxaAa
aAaAaAa
1zzzAbB1zzz
1zzzAbB1zzz
{"1zzz","BbAaAa","Aa","Cc"}
{"1zzz","Bb1zzzAa","1zzz","Cc"}
<2,5,5;5,2,5;5,5,2>
2.0000 5.0000 5.0000
5.0000 2.0000 5.0000
5.0000 5.0000 2.0000
<1,2,2;2,1,2;2,2,1>
{2,1,2,2}
original array: {"","aa","ab","a","","dd"}
joined: |aa|ab|a||dd
split: {"","aa","ab","a","","dd"}
replace empty: {"A","aa","ab","a","A","dd"}
replace if starts with a: {"","A","A","A","","dd"}
replace each starting a: {"","Aa","Ab","A","","dd"}
add to each start: {"Z","Za","Zb","Z","Z","Zd"}
1.0000 1.0000 1.0000 1.0000
2.0000 2.0000 2.0000 2.0000
3.0000 3.0000 3.0000 3.0000
12.000 13.000 14.000 15.000
8.0000 9.0000 10.000 11.000
4.0000 5.0000 6.0000 7.0000
0.00000 1.0000 2.0000 3.0000
3.0000 2.0000 1.0000 0.00000
7.0000 6.0000 5.0000 4.0000
11.000 10.000 9.0000 8.0000
15.000 14.000 13.000 12.000
The following example reads one input line at a time (leading spaces in each line are skipped, because of the starting space in " %z", and reads from that string using scan. The * in "%*d" suppresses assignment, so the integer is skipped in the file.
0.00000 1.0000 2.0000 3.0000
4.0000 5.0000 6.0000 7.0000
8.0000 9.0000 10.000 11.000
12.000 13.000 14.000 15.000
select
1.0000 2.0000
5.0000 6.0000
9.0000 10.000
13.000 14.000
0.00000 1.0000 2.0000 3.0000
8.0000 9.0000 10.000 11.000
12.000 13.000 14.000 15.000
selectif
12.000 13.000 14.000 15.000
selectrc
10.000 15.000 .NaN
3.0000 3.0000 3.0000
4.0000 4.0000 4.0000
1.0000 2.0000 3.0000
4.0000 4.0000 4.0000
2.0000 2.0000 3.0000
4.0000 5.0000 6.0000
0.00000 1.0000
1.0000 0.00000
0.00000 1.0000
1.0000 0.00000
0.00000 1.0000
1.0000 0.00000
0.22489 1.0000 1.0000
-0.91760 -0.67417 1.0000
0.22335 -0.14139 -0.18338
1.0000 0.00000 0.00000
1.0000 1.0000 0.00000
1.0000 1.0000 1.0000
2.0000 0.00000 0.00000
1.0000 2.0000 0.00000
1.0000 1.0000 2.0000
0.00000 2.0000 4.0000 0.00000
1.0000 3.0000 5.0000 0.00000
0.00000 1.0000 2.0000 3.0000
4.0000 5.0000 0.00000 0.00000
columns rows sizec sizer sizerc
int 0 0 1 1 1
double 0 0 1 1 1
matrix[3][2] 2 3 2 3 6
string[3] 3 3 3 1 3
array[2] 2 2 2 1 2
0.46189 0.63974 0.88536 1.1737 1.7240
0.46189 0.63974 0.88536 1.1737 1.7240
0.00000 4.0000 4.0000
1.0000 0.00000 3.0000
4.0000 3.0000 0.00000
0.00000 1.0000 3.0000
4.0000 0.00000 4.0000
3.0000 4.0000 0.00000
1 3 1 3 1 2
1 2 1 2 1 3
3 4 2 2 2 2
3 5 2 3 2 3
2 3 3 5 3 4
2 2 3 4 3 5
0.00000 0.00000 0.00000
1.0000 3.0000 3.0000
4.0000 4.0000 4.0000
0.00000 1.0000 3.0000
0.00000 4.0000 4.0000
0.00000 3.0000 4.0000
1.0000
0.00000
2.0000
[0] =
[1] = aa
[2] = x
[3] = 1
[4] = 2
The following example first smoothes the four variables in the variable my using time as the X variable, and automatic bandwidth selection. The second observation of the first variable is set to a missing value. The second spline smoothes the cross plot of the last three variables against the first, choosing the bandwidth as 12 equivalent parameters.
CONS smooth
890.45 890.01
.NaN 888.19
886.33 886.58
884.88 885.38
885.25 884.66
GCV 13.932 1.4645 24.309
k_e 12.000 11.999 11.999
1.4142 1.7321
1.4142 1.7321
4.0000 9.0000
4.0000 9.0000
268435456 int
1.07374e+009 double
32768 double
The following example (samples/inout/inout5.ox) reads one input line at a time (leading spaces in each line are skipped, because of the starting space in " %z"), and reads from that string using sscan. The * in "%*d" suppresses assignment, so the integer is skipped in the file.
variable: CONS address:32 remainder: data 10-04-1992 13:20:38.33 variable: INC address:1336 remainder: data 10-04-1992 13:20:38.33 variable: INFLAT address:2640 remainder: data 10-04-1992 13:20:38.33 variable: OUTPUT address:3944 remainder: data 10-04-1992 13:20:38.33 the full text is: pcgive 700 data data.bn7 ; Tutorial Data Set : ; 4 equation model with oil shock for PcGive. ; October 1985 >CONS 1953 1 1992 3 4 32 data 01-03-2019 16:59:07 ; Artificial consumption variable >INC 1953 1 1992 3 4 1336 data 01-03-2019 16:59:07 ; Artificial income variable >INFLAT 1953 1 1992 3 4 2640 data 01-03-2019 16:59:07 ; Artificial inflation variable >OUTPUT 1953 1 1992 3 4 3944 data 01-03-2019 16:59:07 ; Artificial output variable variable: CONS address:32 next line at:177 variable: INC address:1336 next line at:282 variable: INFLAT address:2640 next line at:382 variable: OUTPUT address:3944 next line at:485
{"1","2","3","4"}
[0] = 2000-01-01
[1] = 2000-01-02
[2] = 2000-01-03
[3] = 2000-01-04
[4] = 2000-01-05
index = 2
index = 3
index = -1
index =
2.0000 -1.0000 0.00000
first ox is at position 1 in "ooxox"
last ox is at position 3 in "oOXoX" (no case)
x is at position 1 in "ox"
x is at position -1 in "OX"
x is at position 1 in "OX" (no case)
index of x,o in "OX" (no case):
1.0000 0.00000
a string
A STRING
A StrinG
{aa bb}
3.0000 6.0000 9.0000 12.000
5.0000 14.000 29.000 50.000
6.0000 14.000
10.000 30.000
14.000 54.000
chi(2): 1.0000 0.099759 0.050037 normal: 0.97500 0.50000 0.024998 t(4): 0.93922 0.50000 0.060777 t(50): 0.97221 0.50000 0.027790
Note in the example that, strictly speaking, it is not necessary to truncate the random indices in idx, as this is done automatically when using a matrix to index another matrix.
0.22489 1.7400 0.22489 1.7400
-0.21417 -1.0037 -0.21417 -1.0037
0.084549 0.83591 0.084549 0.83591
0.22489 1.7400 0.22489 1.7400
-0.21417 -1.0037 -0.21417 -1.0037
0.084549 0.83591 0.084549 0.83591
408.00 852.00 877.00
1.9639 0.073371 1.9639 0.073371
0.25375 -1.2006 0.25375 -1.2006
-1.1932 -0.52929 -1.1932 -0.52929
0 0 0 0; 2005-01-01
4 4 0 0; 2005-01-01T04:04:00
8 8 0 0; 2005-01-01T08:08:00
12 12 0 0; 2005-01-01T12:12:00
16 16 0 0; 2005-01-01T16:16:00
time today 22:11
time1[0]: 1990-12-01 time1[1]: 1991-01-01 time2: 1990-12-01 12:00:01 today: 2012-06-26 14:27:44 today: 2012 6 26 14 27 44 today: 2012-06-26T14:27:44
-2.0000 -1.0000 1.0000 2.0000
-1.0000 -1.0000 2.0000 2.0000
1.0000 0.00000
0.00000 1.0000
number of extra arguments: 2 vararg [0] = tailor vararg [1] = soldier
1.0356 -0.037133
-0.037133 0.86569
1.0356 0.86569
1.0356 0.86569
1.0356 -0.037133
-0.037133 0.86569
1.0356 -0.037133
-0.037133 0.86569
0.00000
2.0000
1.0000
3.0000
0.00000
2.0000
3.0000
0.00000 2.0000
2.0000 3.0000
0.00000
0.00000
1.0000
2.0000
2.0000
0.00000
2.0000 3.0000 4.0000
0.00000 1.0000 5.0000
examples with arrays and string
1 3
2
0
0 3
0.00000 0.00000
1.0000 1.0000
2.0000 2.0000
3.0000 3.0000
0.00000
1.0000
2.0000
0.00000
2.0000
0.00000
1 argument:
1.0000 2.0000 4.0000
2 arguments:
0.00000 3.0000 5.0000
3 arguments:
0.00000 2.0000
non-zeros:
1.0000 2.0000 2.0000
zeros:
0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000
Ox version 10.01. © JA Doornik This file last changed .