Aptech Systems, Inc. Worldwide Headquarters
Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286
Ready to Get Started?
Request Quote & Product Information
Training & Events
Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.
Have a Specific Question?
Q&A: Register and Login
Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.
Join our community to see why our users are considered some of the most active and helpful in the industry!
Where to Buy
Recent Tagsapplications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall error error handling errors Excel file i/o floating network GAUSS Engine GAUSS Light graphics GUI hotkeys installation Java API license licensing linux loading data loops matrices matrix manipulation Maxlik MaxLikMT Memory multidimensional array optimization Optmum output PQG graphics procs RAM random numbers string functions strings structures threading writing data
Time Series 2.0 MT
Find out more now
Time Series MT 2.1
Find out more now
Question on tilde operator (~) and 'le' logical comparison in GAUSS
proc (1) = gamesim(para,msel,nobs);
local bet1, bet2,
alp, alp1, alp2,
pim1, pim2, pid1, pid2,
pm1, pm2, pd1, pd2,
bet1 = para;
del1 = para;
bet2 = para;
if msel == 1;
del2 = para;
elseif msel == 2;
del2 = del1;
alp1 = para;
alp2 = para;
alp = alp12_to_alp(para[1:6]');
pim1 = bet1 + rndn(nobs,1);
pim2 = bet2 + rndn(nobs,1);
pid1 = pim1 - del1;
pid2 = pim2 - del2;
yy = zeros(nobs,2);
i = 1;
do until i > nobs;
pm1 = pim1[i];
pm2 = pim2[i];
pd1 = pid1[i];
pd2 = pid2[i];
if (pm1<0) AND (pm2<0); yy[i,.] = (0~0); elseif (pd1>0) AND (pd2>0); yy[i,.] = (1~1);
elseif (pm1 GE 0) AND (pm2 < 0); yy[i,.] = (1~0); elseif (pm1 < 0) AND (pm2 GE 0); yy[i,.] = (0~1); elseif (pd1 GE 0) AND (pm2 GE 0) AND (pd2 < 0); yy[i,.] = (1~0); elseif (pm1 GE 0) AND (pd1 < 0) AND (pd2 GE 0); yy[i,.] = (0~1); else; if rndu(1,1) LE alp; yy[i,.] = (1~0); else; yy[i,.] = (0~1); endif; endif; i = i+1; endo; yy = yy~pim1~pim2~pid1~pid2;
Can anyone explain little about the following three part?
"alp = alp12_to_alp(para[1:6]‘);" I don't understand the logic how do we define variable alp
"if rndu(1,1) LE alp;" why did we put LE alp after rndu(1,1)?
and the line:
yy = yy~pim1~pim2~pid1~pid2;
what does "~" means here.
- The line below means: if the 1x1 uniform random number created by rndu is less than or equal to the value of the variable alp.
if rndu(1,1) LE alp;
This line could have been written also this way:
tmp = rndu(1,1); if tmp < alp;
- The line below:
alp = alp12_to_alp(para[1:6]‘);
performs these steps 1) transpose the first 6 elements of para 2) Pass those 6 elements in to a user defined procedure called apl12_to_alp 3) Assign the return from this function call to alp. GAUSS always uses square brackets  for indexing. Parentheses () are used for function calls and for separating operations i.e. (5*6)+7 vs 5*(6+7)
- The tilde operator ~ performs horizontal concatenation in GAUSS. For example:
a = 5; b = 2; c = a~b;
will assign c to be equal to the row vector:
The tilde operator works for scalars, vectors and matrices