Forms variates and classifying factors containing within-group summaries to use e.g. in a between-group analysis (R.W. Payne).

### Options

`CLASSIFICATION` = factors |
Factors defining the groups; must be set |
---|---|

`COUNTS` = variate |
Saves a variate counting the number of units with each factor combination; default `*` |

`WEIGHTS` = variate |
Weights to be used to calculate the within-group summaries; default `*` indicates that all units have weight 1 |

`METHOD` = string token |
How to summarize the data variates (`totals` , `nobservations` , `means` , `minima` , `maxima` , `variances` , `quantiles` , `sds` , `skewness` , `kurtosis` , `semeans` , `seskewness` , `sekurtosis` ); default `mean` |

`PERCENTQUANTILES` = scalar |
Percentage point for quantiles; default 50 |

`OMITEMPTYCELLS` = string token |
Whether to omit units arising from empty cells in the summary table (`yes` , `no` ); default `no` |

`SETLEVELS` = string token |
Whether to redefine the levels of factors (`yes` , `no` ); default `no` |

### Parameters

`VECTOR` = variates and factors |
Original data vectors |
---|---|

`NEWVECTOR` = variates and factors |
New vectors containing the within-group summaries |

### Description

`FBETWEENGROUPVECTORS`

is useful when you have replicated observations on a set of groups. It allows you to form variates, with a unit for each group, containing a summary of the observations within that group. You can also form factors, again with a unit for each group, to define the characteristics of the groups. You can then use these to perform a between-group analysis, with one of the variates acting as the response variate, and the factors and other variates defining the model to be fitted.

The factors defining the groups are specified by the `CLASSIFICATION`

option. The `METHOD`

option specifies how to form summaries of the variates, and you can specify weights by using the `WEIGHTS`

option. For more information about the summaries, see the `TABULATE`

directive, which is used to do the calculations. Factors are summarized by taking the level that occurs most frequently within each group, using the `TABMODE`

procedure.

The `PERCENTQUANTILES`

option specifies the percentage point to use for quantiles. The default is 50 (i.e. the median).

The `OMITEMPTYCELLS`

option indicates whether to omit units arising from empty cells in the summary table. By default, these are included.

The `SETLEVELS`

option allows you to redefine the levels of the new factors, to exclude any that do not occur in the data set. By default, they are not redefined.

The `VECTOR`

parameter specifies the variates and factors to be summarized, and the `NEWVECTOR`

parameter saves the variates and factors containing the summaries. You can also use the `COUNTS`

to save a variate containing counts of the number of units in each group if `WEIGHTS`

is unset, or the sum of their weights if it is set.

Options: `CLASSIFICATION`

, `COUNTS`

, `WEIGHTS`

, `METHOD`

, `PERCENTQUANTILES`

, `OMITEMPTYCELLS`

, `SETLEVELS`

.

Parameters: `OLDVECTOR`

, `NEWVECTOR`

.

### Action with `RESTRICT`

If any `VECTOR`

, or the `WEIGHTS`

variate, or any of the classifying factors is restricted, the summaries will be form using only the restricted subset of units. If more than one variate or factor is restricted, the restrictions must be the same.

### See also

Directive: `EQUATE`

.

Procedures: `FWITHINTERMS`

, `UNSTACK`

.

Commands for: Calculations and manipulation.

### Example

CAPTION 'FBETWEENGROUPVECTORS example'; STYLE=meta SPLOAD '%gendir%/data/oats.gsh' CALCULATE yield = (yield * 80) / (112 * 4) " use FBETWEENGROUPVECTORS to do the between whole-plot analysis of the split plot design in the Guide to Genstat, Part 2, Section 4.2.1 " FBETWEENGROUPVECTORS [CLASSIFICATION=blocks,wplots; COUNTS=plotreps;\ METHOD=mean] blocks,wplots,nitrogen,variety,yield;\ NEWVECTOR=Blocks,Wplots,Nitrogen,Variety,Yield TREATMENTS Variety BLOCK Blocks ANOVA [PRINT=aovtable; WEIGHTS=plotreps] Yield " compare with ordinary ANOVA (the results are the same because the design is orthogonal) " TREATMENTS variety*nitrogen BLOCK blocks/wplots/subplots ANOVA [PRINT=aovtable] yield