Description Usage Arguments Details Author(s) References See Also Examples

Function `getCmatrix`

computes the coefficient matrix used in equating observed ANOVA sum of squares (or mean squares) to their expected values
as linear combination of the unobservable, true variance components. This "can be viewed in some sense as a special form of the method of moments"
approach (Searle et al. 1992, "Variance Components", p. 173).

1 2 | ```
getCmatrix(form, Data, DF = NULL, type = c("MS", "SS"), digits = 12L,
MM = NULL)
``` |

`form` |
(formula) object specifying the random model |

`Data` |
(data.frame) containing all variables in 'form' |

`DF` |
(numeric) vector with the degrees of freedom for each VC, if not specified it will be determined automatically by refitting 'form' to 'Data' |

`type` |
(character) "MS" = mean squares coefficient matrix "SS" = sum of squares coefficient matrix |

`digits` |
(integer) numeric tolerance expressed in number of digits. This is used for testing whether a value is equal to zero (round(x,digits) == 0). |

`MM` |
(Matrix) object referring to the overparameterized model matrix of the full model, if provided, it does not need to be computed twice |

Functions implements the algorithm for finding coefficient-matrix *C* of a method of moments approach to ANOVA-estimation
of variance components (VC), given in the first reference. Matrix *C* corresponds to the coefficient matrix equating
expected ANOVA mean squares (MS) to observed values as linear combinations of the unknown VCs to be estimated.
The most computationally expensive parts of the algorithm were implemented in `C`

, speeding up things a significantly.

Consider formulas: *ms = C * s* and *ss = D * s*, where *ms* and
*ss* are a column-vectors of observed ANOVA MS-, respectively, ANOVA SS-values, *C* and *D* are
coefficient matrices, equating *ms*, respectively, *ss* to linear combinations of VCs *s*,
which are to be estimated. Once matrix *C* or *D* is found, pre-multiplying *s* with its inverse gives ANOVA-estimators of VCs.
This function implements the algorithm described in the first reference, the "Abbreviated Doolittle and
Square Root Methods". One can convert matrices *C* and *D* into the other by multiplying/dividing each element by the respective degrees
of freedom (DF) associated with the corresponding factor in the model. If *~* denotes the operator for element-wise multiplication of two
matrices of the same order (Hadamard-product), *d* is the column vector of DFs, and *M* is a *(r x r)* quadratic matrix with
*M = d 1_r'*, *1_r'* being the transpose of a column-vector of ones with *r* elements,
then holds: *C = D ~ M*.

Andre Schuetzenmeister [email protected]

Gaylor,D.W., Lucas,H.L., Anderson,R.L. (1970), Calculation of Expected Mean Squares by the Abbreviated Doolittle and Square Root Methods. Biometrics 26(4):641-655

1 2 3 4 5 6 7 8 9 10 11 | ```
## Not run:
data(dataEP05A2_1)
C_ms <- getCmatrix(y~day/run, dataEP05A2_1, type="MS")
C_ms
C_ss <- getCmatrix(y~day/run, dataEP05A2_1, type="SS")
C_ss
aov.tab <- anova(lm(y~day+day:run, dataEP05A2_1))
aov.tab
apply(C_ss, 2, function(x) x/aov.tab[,"Df"])
## End(Not run)
``` |

VCA documentation built on July 12, 2017, 5:02 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.