# Prediction

## Complicated weighting

Generally, when forming a prediction table, it is necessary to
average over (or ignore) some potential dimensions of the prediction
table. By default, ASReml uses equal weights (`1/f` for
a factor with `f` levels).
More complicated weighting is achieved by using the !AVERAGE
qualifier to set specific (unequal) weights for each level of a factor.
However, sometimes the weights to be used need to be defined with respect
to two or more factors. The simplest case is when
there are missing cells and weighting is equal for those cells
in a multiway table that are present; achieved by using the
!PRESENT qualifier. This is now further generalised by allowing
the user to fill in the weights for use by the !PRESENT
machinery via the !PRWTS qualifier.
The user specifies the factors in the table of weights
with the !PRESENT statement and then gives the table
of weights using the !PRWTS qualifier. There may
only be one !PRESENT qualifier
on the predict line
when !PRWTS is specified.
The order of factors in the tables of weights must correspond to the
order in the !PRESENT list with later factors nested within preceding
factors. Check the output
to ensure that the values in the tables of weights are
applied in the correct order. ASReml may transpose the table of weights
to match the order it needs for processing.
Consider a rather complicated example from a rotation experiment
conducted over several years. This particular analysis followed the
analysis of the daily live weight gain per hectare of the sheep
grazing the plots. There were periods when no sheep grazed.
Different flocks grazed in the different years. Daily liveweight gain
was assessed between 5 and 8 times in the various years. To
obtain a measure of total productivity in terms of sheep liveweight,
we need to weight the daily per sheep figures by the number of sheep grazing days per month.
To obtain treatment effects for each year,
the experimenter used

predict year 1 crop 1 pasture lime !AVE month 56 55 56 53 57 63 6*0
predict year 2 crop 1 pasture lime !AVE month 36 0 0 53 23 24 54 54 43 35 0 0
predict year 3 crop 1 pasture lime !AVE month 70 0 21 17 0 0 0 70 0 0 53 0
predict year 4 crop 1 pasture lime !AVE month 53 56 22 92 19 44 0 0 36 0 0 49
predict year 5 crop 1 pasture lime !AVE month 0 22 0 53 70 22 0 51 16 51 0 0

but then wanted to average over years as well.
Both of the following predict statements produce the required values.

predict crop 1 pasture lime !PRES year month !PRWTS { 56 55 56 53 57 63 0 0 0,
0 0 0 36 0 0 53 23 24 54 54 43 35 0 0 70 0 21 17 0 0 0 70 0 0 53 0 53,
56 22 92 19 44 0 0 36 0 0 49 0 22 0 53 70 22 0 51 16 51 0 0}/5
predict crop 1 pasture lime !PRES month year !PRWTS { 56 36 70 53 0,
55 0 0 56 22 56 0 21 22 0 53 53 17 92 53 57 23 0 19 70 63 24 0 44 22,
0 54 0 0 0 0 54 70 0 51 0 43 0 36 16 0 35 0 0 51 0 0 53 5*0 49 0}/5

We have presented both sets of predict statements to show how the
weights were derived and presented. Notice that the order in
!PRESENT year month implies that the weight coefficients are
presented with values for months nested within years.
There is a check which reports if non zero weights are
associated with cells that have no data.
The weights are reported in the .pvs file.
!PRESENT counts are reported
in the .res file.
**Return to start**