# Scientific probability calculator

G*Power contains a simple but powerful calculator that can be opened by selecting the ”Calculator” menu item (the calculator is currently available only in the Windows version of G*Power). The small example script shown here calculates the power for the one-tailed t test for matched-pairs and demonstrates most of the available features:
• There can be any number of expressions.
• The result is set to the value of the last expression in the script.
• Several expression on a line are separated by a semicolon.
• Expressions can be assigned to variables that can be used in following expressions.
• The character # starts a comment. The rest of the line following # is ignored.
• Many standard mathematical functions like square root, sin, cos etc are supported (for a list, see below).
• Many important statistical distributions are supported (see list below).
• The script can be easily saved and loaded. In this way a number of useful helper scripts can be created.

The calculator supports the following arithmetic operations (shown in descending precedence):
Power: ˆ (2ˆ3 = 8)
Multiply: ∗ (2 ∗ 2 = 4)
Divide: / (6/2 = 3)
Plus: + (2 + 3 = 5)
Minus: - (3 − 2 = 1)

The calculator supports the following general functions:

abs(x) - Absolute value |x|
acos(x) - Arcus cosinus of x
asin(x) - Arcus sinus of x
atan(x) - Arcus tangens of x
atan2(x,y) - Arcus tangens of y/x
cos(x) - Cosinus of x
exp(x) - Exponential ex
frac(x) - Fractional part of ﬂoating point x: frac(1.56) is 0.56
int(x) - Integer part of ﬂoat point x: int(1.56) is 1
lngamma(x) Natural logarithm of the gamma function ln(Γ(x))
log(x) - Natural logarithm ln(x)
max(x,y) - Maximum of x and y
min(x,y) - Minimum of x and y
sign(x) - Sign of x: x < 0 → −1, x = 0 → 0, x > 0 → 1
sin(x) - Sinus of x
sqr(x) - Square x2
sqrt(x) - Square root √x
tan(x) - Tangens of x
uround(x,m) - round x up to a multiple of m; uround(2.3, 1) = 3, uround(2.3, 2) = 4

The calculator supports the following distribution functions (CDF = cumulative distribution function, PDF = probability density function, Quantile = inverse of the CDF). For information about the properties of thes distributions check Wolfram Mathworld .

betacdf(x,a,b) - CDF...
betapdf(x,a,b) - PDF...
betainv(x,a,b) - Quantile...
...of the beta distribution with shape parameters a and b.

binocdf(x,N,p) - CDF...
binopdf(x,N,p) - PDF...
binoinv(x,N,p) - Quantile...
...of the binomial distribution for sample size N and success probability p.

chi2cdf(x,df) - CDF...
chi2pdf(x,df) - PDF...
chi2inv(x,df) - Quantile...
...of the chi square distribution with df degrees of freedom: χ2df(x).

corrcdf(r,ρ,N) - CDF
corrpdf(r,ρ,N) - PDF
corrinv(p,ρ,N) - Quantile
...of the distribution of the sample correlation coefﬁcient r for population correlation ρ and samples of size N.

expcdf(x,λ - CDF
exppdf(x,λ) - PDF
expinv(p,λ - Quantile
...of the exponential distribution with parameter λ.

fcdf(x,df1,df2) - CDF...
fpdf(x,df1,df2) - PDF...
finv(x,df1,df2) - Quantile...
...of the F distribution with df1 numerator and df2 denominator degrees of freedom Fdf1,df2(x).

hygecdf(x,N,ns,nt) - CDF...
hygepdf(x,N,ns,nt) - PDF...
hygeinv(x,N,ns,nt) - Quantile...
...of the hypergeometric distribution for samples of size N from a population of total size nt with ns successes.

laplcdf(x,m,s) - CDF
laplpdf(x,m,s) - PDF
laplinv(p,m,s) - Quantile
...of the Laplace distribution, where m, s denote location and scale parameter.

logncdf(x,m,s) - CDF
lognpdf(x,m,s) - PDF
logninv(p,m,s) - Quantile
...of the log-normal distribution, where m, s denote mean and standard deviation of the associated normal distribution.

mr2cdf(R2 , ρ2 ,k,N) - CDF
mr2pdf(R2 , ρ2 ,k,N) - PDF
mr2inv(p,ρ2 ,k,N) - Quantile
of the distribution of the sample squared multiple correlation coefﬁcient R2 for population squared multiple correlation coefﬁcient ρ2, k − 1 predictors, and samples of size N.

ncfcdf(x,df1,df2,nc) - CDF...
ncfpdf(x,df1,df2,nc) - PDF...
ncfinv(x,df1,df2,nc) - Quantile...
...of the noncentral F distribution with df1 numerator and df2 denominator degrees of freedom and noncentrality parameter nc.

nctcdf(x,df,nc) - CDF...
nctpdf(x,df,nc) - PDF...
nctinv(x,df,nc) - Quantile...
...of the noncentral Student t distribution with df degrees of freedom and noncentrality parameter nc.

ncx2cdf(x,df,nc) - CDF...
ncx2pdf(x,df,nc) - PDF...
ncx2inv(x,df,nc) - Quantile...
...of the noncentral chi square distribution with df degrees of freedom and noncentrality parameter nc.

normcdf(x,m,s) - CDF...
normpdf(x,m,s) - PDF...
norminv(x,m,s) - Quantile...
...of the normal distribution with mean m and standard deviation s.

poisscdf(x,L) - CDF...
poisspdf(x,L) - PDF...
poissinv(x,L) - Quantile...
poissmean(x,L) - Mean...
...of the poisson distribution with mean λ = L.

tcdf(x,df) - CDF...
tpdf(x,df) - PDF...
tinv(x,df) - Quantile...
...of the Student t distribution with df degrees of freedom tdf(x).

unicdf(x,a,b) - CDF
unipdf(x,a,b) - PDF
uniinv(p,a,b) - Quantile
...of the uniform distribution in the intervall [a, b].

zcdf(x) - CDF...
zpdf(x) - PDF...
zinv(x) - Quantile...
...of the standard normal distribution.

Donnerstag, 23. 05. 2013