Equation Entry

This document describes the entry of equations into the Stat-Ease 360 simulator.

Note: For more examples of entering simulation equations, see here.

Standard polynomials in terms of the factors can be entered. These take the form of intercept + coefficients times a term.

Polynomial Example

50 + 6A + 7B – 15AB

Categoric Factors

Categoric factors have two forms. These examples are based on a three-level factor A and a four-level factor B and their interaction.

Example 1

50 + {6,-2}A + {-2,-1,1}B + {12, -4, 8, -3, -1,0}AB

This method is shorter and matches the simulator for version 8 and earlier.

Example 2

50+6 * A[1]-2 * A[2]-2 * B[1]-1 * B[2]+1 * B[3]+12 * A[1]B[1]-4 *
A[2]B[1]+8 * A[1]B[2]-3 * A[2]B[2]-1 * A[1]B[3]+0 * A[2]B[3]

This version matches Stat-Ease 360 9 and later ANOVA model output.

Functions

Functions must be entered using lower case letters; variable IDs can be either lowercase or capitals

Functions take the form of <function name>(function or factor ID or number). The parentheses are required.

Name

Explanation

sin

sine function

cos

cosine function

tan

tangent function

asin

arcsine function

acos

arccosine function

atan

arctangent function

sinh

hyperbolic sine function

cosh

hyperbolic cosine function

tanh

hyperbolic tangent function

asinh

hyperbolic arcsine function

acosh

hyperbolic arccosine function

atanh

hyperbolic arctangent function

log2

logarithm to the base 2

log10

logarithm to the base 10

log

logarithm to the base 10

ln

logarithm to base e (2.71828…)

exp

e raised to the power of x

sqrt

square root of a value

sign

sign function -1 if x<0; 1 if x>0

rint

round to nearest integer

abs

absolute value

min

min of all arguments

max

max of all arguments

sum

sum of all arguments

avg

mean value of all arguments

logit

log(p/(1-p)), 0 < p < 1

ilogit

inverse logit (see also: sigmoid, expit, logistic function)

Example

To enter the absolute value of the sin function for A * B:

abs(sin(a*b)) - or - abs(sin(A*B)) - or even - abs(sin(A*b)) are all equivalent.

Binary Operators

The following table lists the default binary operators supported by the parser.

Operator

Meaning

Priority

=

assignment

-1

&&

logical and

1

||

logical or

2

<=

less or equal

4

>=

greater or equal

4

!=

not equal

4

==

equal

4

>

greater than

4

<

less than

4

+

addition

5

-

subtraction

5

*

multiplication

6

/

division

6

^

raise x to the power of y

7

if-then-else operations as follows:

(x ? y : z) – Evaluate x, if x is true, do y, if x is false do z. Both the “if true” and “if false” actions must be specified.

Random Variable Generators

Function

Distribution

rnorm(μ, σ)

Normal

rlnorm(μ, σ)

Log Normal

rbinom(n, p)

Binomial

rnbinom(n, p)

Negative Binomial

rbernoulli(p), rbern(p)

Bernoulli

rf(df1, df2)

Fisher F

runif(a, b)

Uniform

rchisq(df)

Chi-squared

rgumbel(μ, β)

Gumbel

rpois(λ)

Poisson

rt(df)

Student’s t

rweibull(λ, k)

Weibull

rgamma(α, β)

Gamma

rexp(λ)

Exponential

rcauchy(x0, γ)

Cauchy

rgeom(p)

Geometric

rbeta(α, β)

Beta

Constants

Constant

Description

_pi

pi

_e

Euler’s number

_c

Speed of light in vacuum \((m*s^{-1})\)

_h

Planck’s Constant \((J*s)\)

_hbar

Reduced Planck’s Constant \((J*s)\)

_G

Newtonian constant of gravitation \((m^3*kg^{-1}*s^{-2})\)

_k_B

Boltzmann constant \((J*K^{-1})\)

_N_A

Avogadro constant \((mol^{-1})\)

_epsilon_0

Electric constant or vacuum permittivity \((F*m^{-1})\)

_mu_0

Magnetic constant or vacuum permeability \((N*A^{-2})\)