### Aptech Systems, Inc. Worldwide Headquarters

Address:

Aptech Systems, Inc.

2350 East Germann Road, Suite #21

Chandler, AZ 85286Phone: 360.886.7100

FAX: 360.886.8922**Ready to Get Started?**### Request Quote & Product Information

### Industry Solutions

### Products

### Resources

### Support

### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

### Tutorials

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

### Support Plans

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.

### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!

### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.

### Recent Tags

applications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall econometrics Editor error error codes errors Excel file i/o floating network GAUSS Engine GAUSS Light graphics GUI hotkeys installation license licensing linux loading data loop loops matrix manipulation Maximum Likelihood Maxlik MaxLikMT Memory multidimensional array optimization Optmum output panel data PQG graphics procs random numbers strings structures threading### Recent Questions

- plotSetXRange is not working
- Gauss Mac Installation
- Can i get MaxLik Packge for Mac OS
- How to run Narayan and Popp (2010) unit root test with two structural break
- ThreadFor again
- cml.lcg zip file
- nelder-mead optimization algorithm
- Kernel regression - kreg
- exponential matrix
- Panel unit root test with structural breaks - calculating break dates

### Features

### Time Series 2.0 MT

### Industry Solutions

### Find out more now

### Time Series MT 2.1

### Find out more now

### Find out more now

# Resources

# Question on tilde operator (~) and 'le' logical comparison in GAUSS

proc (1) = gamesim(para,msel,nobs);

local bet1, bet2,

del1, del2,

alp, alp1, alp2,

pim1, pim2, pid1, pid2,

pm1, pm2, pd1, pd2,

yy,

i;

bet1 = para[1];

del1 = para[2];

bet2 = para[3];

if msel[1] == 1;

del2 = para[4];

elseif msel[1] == 2;

del2 = del1;

endif;

alp1 = para[5];

alp2 = para[6];

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

retp(yy);

endp;

## 2 Answers

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:5 2

The tilde operator works for scalars, vectors and matrices

## Your Answer

## 2 Answers

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:5 2

The tilde operator works for scalars, vectors and matrices