###### Description

modelFunctions: This class of special functions constructs model terms with specific properties.

###### Usage

con(obj) lin(obj) pow(obj, p=1, offset=0) pol(obj, t=1, init=NA) leg(obj,t=1,init=NA) spl(obj, k=0, init=NA) dev(obj, init=NA) ma(obj) at(obj,lvls) and(obj, times=1) mbf(obj) grp(obj) dsum(model, levels=NULL, outer=FALSE) C(obj, contr)

###### Arguments

`obj` |
An object in the data frame.`mbf` – A component name from the `asreml() mbf` list argument.`grp` – A component name from the `asreml() group` list argument. |

`p` |
The exponent in a power function term (`pow` ). |

`offset` |
Constant added to `obj` ; default 0. |

`t` |
pol – The maximum degree of a set of orthogonal polynomials formed from `obj` . If negative, the intercept polynomial is omitted.leg – The maximum degree of a set of Legendre polynomials formed from `obj` . If negative, the intercept polynomial is omitted. |

`k` |
The number of equally spaced knot points for a cubic smoothing spline. If zero or omitted, `k` is set to `asreml.options()$knots` (default 50). |

`init` |
Optional initial value for the default identity variance model (`idv` ) when used in the `random` formula. |

`lvls` |
Vector of levels of the conditioning factor (`obj` ) that define the conditioning covariates formed by `at` . If numeric, `lvls` indexes the levels vector of `obj` ; that is, `levels(obj)[lvls]` . |

`times` |
Multiples (may be non-integer) of the design matrix for `obj` are added to the preceding design matrix. |

`model` |
A formula of the form `~A+B+...|Z` , where `A` and `B` define variance matrices for simple or compound model terms, and `Z` is a simple conditioning factor whose levels identify and determine the number of sub-matrices in the direct sum. The “|” operator is applied associatively and operates with all terms on its left; that is, `A+B|C` implies `(A+B)|C` and is equivalent to `A|C+B|C` . |

`levels` |
A list of length the number of terms in the left hand side of `model` that are separated by “+”. The components of `levels` are vectors of factor levels of `Z` . If there is only one term in the left hand side of `model` (or if the context allows, see examples) then `levels` may be a vector. If `NULL` , the default is to use `levels(Z)` . |

`outer` |
If `TRUE` , independent blocks of correlated observations are modelled with common variance and correlation parameters; the blocks can be of different sizes. |

`contr` |
An integer vector of contrast coefficients parallel to `levels(obj)` . |

###### Functions

`asr_con` |
Sum to zero constraints. |

`asr_lin:` |
Create a variate from `obj` . |

`asr_pow:` |
Creates the model term (`obj+offset)` . |

`asr_pol:` |
Orthogonal polynomials. |

`asr_leg:` |
Legendre polynomials. |

`asr_spl:` |
Cubic smoothing spline, random component. |

`asr_dev:` |
Spline deviations; create a factor from the variate `obj` . |

`asr_ma:` |
Construct a term with a moving-average order 1 design matrix from `obj` . |

`asr_at:` |
Form a conditioning covariable from obj for each level of `obj` specified in the `lvls` argument. |

`asr_and:` |
Multiply the design matrix for `obj` by `times` and add it to the preceding design matrix. |

`asr_mbf:` |
Create a model term from covariates not stored in `data` . |

`asr_grp:` |
Create a model term from covariates held in columns of `data` . |

`asr_dsum:` |
Direct sum structures for residual models. |

`asr_C:` |
Treatment contrasts. |

###### Examples

## Not run: ## separable autoregressive residual model at each level of Site residual = ~ dsum(~ ar1(Column):ar1(Row) | Site) ## different residual models at different levels of site residual = ~ dsum(~ ar1(Column):ar1(Row) + id(Column):ar1(Row) | Site, levels = list(c(1,3), c(2,4))) ## equivalent residual = ~ dsum(~ ar1(Column):ar1(Row) | Site, levels=c(1,3)) + dsum(~ id(Column):ar1(Row) | Site, levels=c(2,4)) ## "biological" Date within Plot residual = ~ dsum(~ ar1(Date) | Plot, outer=TRUE) ## "explicit" times residual = ~ dsum(~ exp(Date) | Plot, outer=TRUE) ## End(Not run)