# doc-cache created by Octave 11.2.0
# name: cache
# type: cell
# rows: 3
# columns: 5
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
ff2n


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 415
statistics: dFF2 = ff2n ( n )

Two-level full factorial design.

dFF2 = ff2n ( n ) gives factor settings dFF2 for a two-level
full factorial design with n factors. dFF2 is m-by-n, where m is the
number of treatments in the full-factorial design. Each row of dFF2
corresponds to a single treatment. Each column contains the settings for a
single factor, with values of 0 and 1 for the two levels.

See also:
fullfact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Two-level full factorial design.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
fullfact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 464
statistics: A = fullfact ( levels )

Full factorial design.

A = fullfact ( levels ) returns a numeric matrix A
with the treatments of a full factorial design specified by levels ,
which must be a numeric vector of real positive integer values with each
value specifying the number of levels of each individual factor.

Each row of A corresponds to a single treatment and each column to a
single factor. For binary full factorial design, use ff2n .

See also:
ff2n


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Full factorial design.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
parseWilkinsonFormula


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6099
statistics: terms = parseWilkinsonFormula ( formula )
statistics: result = parseWilkinsonFormula ( formula , mode )
statistics: [ X , y , names ] = parseWilkinsonFormula ( formula , "model_matrix", data )
statistics: S = parseWilkinsonFormula ( formula , "mixed")

Parse and expand statistical model formulae using the Wilkinson notation.

This function implements the recursive-descent parser and expansion logic
described by Wilkinson & Rogers (1973) for factorial models. It allows the
symbolic specification of analysis of variance and regression models,
converting strings into computational schemas or design matrices. It also
supports multi-variable response specification on the Left-Hand Side (LHS)
using lists or ranges.

parseWilkinsonFormula accepts as its first input argument a Wilkinson
notation string specified by formula either as a character vector or a
string scalar with the following list of valid symbols:

Right-Hand Side (Model) Operators
The RHS specifies the independent variables (predictors) and the structural
relationships between them, such as interactions and nesting. The parser
expands these expressions into fundamental model terms following the standard
statistical rules of marginality. Additionally, explicit nesting notation
(e.g., B(A) ) is supported to denote that factor B is nested within A.

Operator Description Expansion Example
+ Addition (Union) A + B expands to A, B
* Crossing A * B expands to A, B, A:B
- Deletion A*B - A:B expands to A, B
/ Nesting A / B expands to A, A:B
: Interaction A : B expands to A:B
^ Power (Limit) (A+B)^2 expands to A, B, A:B
1 Intercept y ~ A - 1 removes intercept

Left-Hand Side (Response) Operators
The LHS, separated by the ~ operator, defines the dependent variables.
It natively supports multi-response syntaxes.

Operator Description Usage Example
~ Formula separator y ~ x
, List separator y1, y2 ~ x
- Range operator T1 - T3 ~ x

Processing Modes
parseWilkinsonFormula ( formula , mode ) evaluates the
formula string based on the selected mode :

'expand' (default) - Returns a structure containing
response and model fields. Each field contains cell arrays
of the expanded, fundamental terms.
'equation' - Generates a string representing the mathematical
equation of the fitted model. Coefficients are represented generically as
c1, c2, ... . If multiple responses are specified, it returns a
string array of equations.

Formula String Equation Output
y ~ x "y = c1 + c2*x"
y ~ A * B "y = c1 + c2*A + c3*B + c4*A*B"
y ~ School / Class "y = c1 + c2*School +
c3*Class*School"
y ~ x^2 "y = c1 + c2*x + c3*x^2"
y1 - y2 ~ Trt ["y1 = c1 + c2*Trt", "y2 = ..."]

'matrix' - Returns a schema structure containing a binary
matrix defining term membership, useful for internal algorithmic processing.
'model_matrix' - Constructs the numeric Design Matrix ( X )
and Response Matrix ( y ) directly from a provided data table.
'parse' - Returns the raw Abstract Syntax Tree (AST) structure.
'tokenize' - Returns the array of tokens generated by the lexer.
'mixed' - Decomposes a mixed-effects formula containing
random-effects terms of the form ( expr | group ) into its
fixed and random parts. See Mixed-Effects Formulae below.

Data Handling (&rsquo;model_matrix&rsquo; mode)
When using the 'model_matrix' mode, a data argument must be
provided as an Octave table .

Categorical Variables: Cell arrays of strings in the table
are automatically detected as categorical factors and undergo corner-point
(reference) dummy coding.
Numeric Variables: Standard numeric vectors are treated as
continuous predictors or responses.
Missing Data: Rows containing NaN values in any of the
active variables are automatically omitted from the final matrices.

Mixed-Effects Formulae (&rsquo;mixed&rsquo; mode)
A random-effects term is written ( expr | group ) , where
expr is a Wilkinson design expression for the random intercept and
slopes and group is the grouping factor (or an interaction of factors
such as g1:g2 ). As with fixed effects an intercept is implicit;
suppress it with 0 or -1 (for example (x - 1 | g) or
(-1 + x | g) for a random slope with no random intercept). The
'mixed' mode returns a structure with the following fields:

Response
The response (LHS) as a character vector.
FixedTerms
A cell array of the expanded fixed-effects terms, excluding the intercept.
FixedIntercept
A logical flag, true when the fixed model includes an intercept.
Random
A struct array with one element per random-effects term, each with fields
Expr (the raw expression), Terms (its expanded predictor
terms), Intercept (logical), Group (the raw grouping spec),
and GroupVars (its grouping variables as a cell array).
HasRandom
A logical flag, true when the formula contains any random-effects term.

A formula with no random-effects term is still valid in 'mixed' mode:
it returns HasRandom false and an empty Random array.

Outputs

terms / result
The processed model structure, string array, or cell array depending on the
selected mode .
X
The generated numeric design matrix (Observations x Parameters). Includes
a column of ones for the intercept unless - 1 is in the formula.
y
The numeric response matrix (Observations x K responses).
names
A cell array of character vectors containing the column names corresponding
to the generated design matrix X .

References

Wilkinson, G. N. and Rogers, C. E. (1973). Symbolic Description of Factorial
Models for Analysis of Variance. Applied Statistics, 22, 392-399.

In "model_matrix" mode a categorical variable expands to indicator
columns, one per level bar the reference level, which the intercept carries.
The levels of a character or string column are taken in the order the data
presents them, so the reference level is the one seen first; a
categorical column uses its own category order. When the formula has
no intercept, the first categorical variable is given an indicator for every
one of its levels and any further categorical variable stays reference
coded. MATLAB omits the reference level whether or not an intercept is
present, and so cannot fit the reference group.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Parse and expand statistical model formulae using the Wilkinson notation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
sigma_pts


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1024
statistics: pts = sigma_pts ( n )
statistics: pts = sigma_pts ( n , m )
statistics: pts = sigma_pts ( n , m , K )
statistics: pts = sigma_pts ( n , m , K , l )

Calculates 2* n +1 sigma points in n dimensions.

Sigma points are used in the unscented transform to estimate the result of
applying a given nonlinear transformation to a probability distribution that
is characterized only in terms of a finite set of statistics.

If only the dimension n is given the resulting points have zero mean
and identity covariance matrix. If the mean m or the covariance matrix
K are given, then the resulting points will have those statistics. The
factor l scales the points away from the mean. It is useful to tune the
accuracy of the unscented transform.

There is no unique way of computing sigma points, this function implements
the algorithm described in section 2.6 "The New Filter" pages 40-41 of

Uhlmann, Jeffrey (1995). "Dynamic Map Building and Localization: New
Theoretical Foundations". Ph.D. thesis. University of Oxford.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Calculates 2*n+1 sigma points in n dimensions.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
x2fx


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2466
statistics: [ d , model , termstart , termend ] = x2fx ( x )
statistics: [ d , model , termstart , termend ] = x2fx ( x , model )
statistics: [ d , model , termstart , termend ] = x2fx ( x , model , categ )
statistics: [ d , model , termstart , termend ] = x2fx ( x , model , categ , catlevels )

Convert predictors to design matrix.

d = x2fx ( x , model ) converts a matrix of predictors
x to a design matrix d for regression analysis. Distinct
predictor variables should appear in different columns of x .

The optional input model controls the regression model. By default,
x2fx returns the design matrix for a linear additive model with a
constant term. model can be any one of the following strings:

"linear" Constant and linear terms (the default)
"interaction" Constant, linear, and interaction terms
"quadratic" Constant, linear, interaction, and squared terms
"purequadratic" Constant, linear, and squared terms

If x has n columns, the order of the columns of d for a full
quadratic model is:

The constant term.

The linear terms (the columns of X, in order 1,2,...,n).

The interaction terms (pairwise products of columns of x , in order
(1,2), (1,3), ..., (1,n), (2,3), ..., (n-1,n).

The squared terms (in the order 1,2,...,n).

Other models use a subset of these terms, in the same order.

Alternatively, MODEL can be a matrix specifying polynomial terms of arbitrary
order. In this case, MODEL should have one column for each column in X and
one r for each term in the model. The entries in any r of MODEL are powers
for the corresponding columns of x . For example, if x has
columns X1, X2, and X3, then a row [0 1 2] in model would specify the
term (X1.^0).*(X2.^1).*(X3.^2). A row of all zeros in model specifies
a constant term, which you can omit.

d = x2fx ( x , model , categ ) treats columns with
numbers listed in the vector categ as categorical variables. Terms
involving categorical variables produce dummy variable columns in d .
Dummy variables are computed under the assumption that possible categorical
levels are completely enumerated by the unique values that appear in the
corresponding column of x .

d = x2fx ( x , model , categ , catlevels )
accepts a vector catlevels the same length as categ , specifying
the number of levels in each categorical variable. In this case, values in
the corresponding column of x must be integers in the range from 1 to
the specified number of levels. Not all of the levels need to appear in
x .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Convert predictors to design matrix.





