1. Home
  2. VPREDICT directive

VPREDICT directive

Forms predictions from a REML model.

Options

PRINT = string tokens What to print (description, predictions, se, sed, avesed, vcovariance); default desc, pred, se, aves
CHANNEL = scalar Channel number for output; default * i.e. current output channel
MODEL = formula Indicates which model terms (fixed and/or random) are to be used in forming the predictions; default * includes all the fixed terms and relevant random terms
OMITTERMS = formula Specifies terms to be excluded from the MODEL; default * i.e. none
FACTORIAL = scalar Limit on the number of factors or variates in each term in the models specified by MODEL or OMITTERMS; default 3
PRESENTCOMBINATIONS = identifiers Lists factors for which averages should be taken across combinations that are present
WEIGHTS = tables One-way tables of weights classified by factors in the model; default *
PREDICTIONS = table or scalar To save the predictions; default *
SE = table or scalar To save standard errors of predictions; default *
SED = symmetric matrix To save standard errors of differences between predictions; default *
VCOVARIANCE = symmetric matrix To save variances and covariances of predictions; default *
SAVE = REML save structure Specifies the save structure from which to predict; default * i.e. that from most recent REML

Parameters

CLASSIFY = vectors Variates and/or factors to classify table of predictions
LEVELS = variates, scalars or texts To specify values of variates and/or levels of factors for which predictions are calculated
PARALLEL = identifiers For each vector in the CLASSIFY list, allows you to specify another vector in the CLASSIFY list with which the values of this vector should change in parallel (you then obtain just one dimension in the table of predictions for these vectors)
NEWFACTOR = identifiers Identifiers for new factors that are defined when LEVELS are specified

Description

The VPREDICT directive can be used after the REML directive to produce predictions of the values of the response variate at particular values of the variables in the fixed or random models. By default the predictions are from the most recent REML analysis, but you can use another analysis by supplying its save structure using the SAVE option.

The CLASSIFY parameter specifies those variates or factors to be included in the table of predictions, and the LEVELS parameter supplies the values at which the predictions are to be made. For a factor, you can select some or all of the levels, while for a variate you can specify any set of values. A single level or value is represented by a scalar; several levels or values must be combined into a variate (which may of course be unnamed). Alternatively, if the factor has labels, you can use these to select the levels for prediction by setting LEVELS to a text. A missing value in the LEVELS parameter is taken to stand for all the levels of a factor, or the mean value of a variate.

The PARALLEL parameter allows you to indicate that a factor or variate should change in parallel with another factor or variate. Both of these should have the same number of values specified for it by the LEVELS parameter of VPREDICT. The predictions are then formed for each set of corresponding values rather than for every combination of these values. For example, suppose we had fitted a fixed model containing a factor Treatment, a variate Time representing the times when measurements were made, and a variate Timesqrd containing the squares of the times. We could then put

VPREDICT Treatment,Timesqrd,Time; PARALLEL=*,Time,*;\

         LEVELS=*,!(0,1,9,25,49,81),!(0,1,3,5,7,9)

to produce predictions at times 0, 1, 3, 5, 7 and 9 for the treatments. The PARALLEL parameter specifies that Timesqrd should change in parallel to Time, so that we obtain predictions only for matching values of Time and Timesqrd.

When you specify LEVELS, VPREDICT needs to define a new factor to classify that dimension of the table. By default this will be an unnamed factor, but you can use the NEWFACTOR parameter to give it an identifier. The EXTRA attribute of the factor is set to the name of the corresponding factor or variate in the CLASSIFY list; this will then be used to label that dimension of the table of predictions.

The prediction calculations consist of two steps. The first step is to calculate a table of fitted values. The MODEL, OMITTERMS and FACTORIAL options specify the model to use for this. The formula specified by MODEL is expanded into a list of model terms, deleting any that contain more variates of factors than the limit specified by the FACTORIAL option. Then, any terms in the formula specified by OMITTERMS are removed.

The second step averages the fitted values over the classifications that are not in the list that was supplied by the CLASSIFY parameter. The WEIGHTS option can supply one-way tables classified by any of the factors in the model. These are used to calculate the weight to be used for each fitted value when calculating the averages. Equal weights are assumed for any factor for which no table of weights has been supplied. (Note, this differs from the default in PREDICT, which uses marginal weights; see the PREDICT option ADJUSTMENT for details.) In the averaging all the fitted values are generally used. However, if you define a list of factors using the PRESENTCOMBINATIONS option, any combination of levels of these factors that does not occur in the data will be omitted from the averaging. Where a prediction is found to be inestimable, i.e. not invariant to the model parameterization, a missing value is given.

Printed output is controlled by settings of the PRINT option with settings:

    description describes the terms and standardization policies used when forming the predictions,
    predictions prints the predictions,
    se produces predictions and standard errors,
    sed prints standard errors for differences between the predictions,
    avesed prints the average standard error of difference of the predictions, and
    vcovariance prints the variance and covariances of the predictions.

By default descriptions, predictions, standard errors and an average standard error of differences are printed. You can also save the results, using the PREDICTIONS, SE, SED and VCOVARIANCE options. You can send the output to another channel, or to a text structure, by setting the CHANNEL option.

Options: PRINT, CHANNEL, MODEL, OMITTERMS, FACTORIAL, PRESENTCOMBINATIONS, WEIGHTS, PREDICTIONS, SE, SED, VCOVARIANCE, SAVE.

Parameters: CLASSIFY, LEVELS, PARALLEL.

See also

Directives: REML, VCOMPONENTS, VDISPLAY, VKEEP, PREDICT.

Procedures: VFUNCTION, VLSD, VMCOMPARISON, HGPREDICT.

Commands for: REML analysis of linear mixed models.

Example

" Examples 2:5.3.1-4, 2:5.5.1, 2:5.5.2, 2:5.9.1a, 2:5.9.2 "
" Split-plot design (Yates 1937, p.74; also John 1971, p.99)."
UNITS [NVALUES=72]
FACTOR [LEVELS=6] Blocks  
& [LEVELS=3] Wplots  
& [LEVELS=4] Subplots
GENERATE Blocks,Wplots,Subplots
FACTOR [LABELS=!T(Victory,'Golden rain',Marvellous)] Variety
& [LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen
VARIATE Yield; EXTRA=' of oats' 
READ [SERIAL=yes] Nitrogen,Variety,Yield 
 4 3 2 1 1 2 4 3 1 2 3 4 3 1 2 4 4 1 2 3 2 1 3 4
 2 3 4 1 4 2 3 1 1 4 2 3 3 4 1 2 1 3 4 2 2 3 4 1
 4 1 3 2 3 4 1 2 3 4 2 1 3 1 4 2 4 3 1 2 1 2 3 4 :
 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 1 1 1 1 2 2 2 2
 2 2 2 2 3 3 3 3 1 1 1 1 3 3 3 3 2 2 2 2 1 1 1 1
 2 2 2 2 1 1 1 1 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 :
156 118 140 105 111 130 174 157 117 114 161 141
104  70  89 117 122  74  89  81 103  64 132 133
108 126 149  70 144 124 121  96  61 100  91  97
109  99  63  70  80  94 126  82  90 100 116  62
 96  60  89 102 112  86  68  64 132 124 129  89
118  53 113  74 104  86  89  82  97  99 119 121 :
VCOMPONENTS [Nitrogen*Variety] Blocks/Wplots/Subplots
REML [METHOD=Fisher] Yield
VDISPLAY [PRINT=means,stratumvariances]
VLSD Nitrogen
VGRAPH
VDISPLAY  [PRINT=effects; PTERMS=Nitrogen]
VDEFFECTS [PSE=alleffects] Nitrogen
VPLOT
VARIATE [VALUES=2(1...18)2] Row
& [VALUES=(1,2)18,(3,4)18] Column
VDFIELDRESIDUALS Y=Row; X=Column
REML     [PRINT=*] Yield
VPREDICT [PRINT=description,prediction,avesed] Nitrogen
VPREDICT [PRINT=description,prediction,avesed] Variety
VPREDICT [PRINT=description,prediction,sed] Variety,Nitrogen
TABLE     [CLASSIFICATION=Nitrogen; VALUES=-3,1,1,1] Ncomp
CALCULATE Ncomp = Ncomp / 3
VTCOMPARISONS Ncomp
VKEEP TERMS=Variety; MEANS=MV; SEDMEANS=SedV; VARMEANS=VarV
& [SIGMA2=Sigma2] Blocks/Wplots; COMPONENTS=Cb,Cwp
PRINT MV
PRINT [RLPRINT=integers,labels; CLPRINT=integers; RLWIDTH=20] SedV
PRINT [RLPRINT=integers,labels; CLPRINT=integers] VarV
PRINT Cb,Cwp,Sigma2
VFRESIDUALS [RESIDUALS=residual; SERESIDUALS=seresidual;\
            FITTEDVALUES=fittedvalue; SEFITTEDVALUES=sefittedvalue]
PRINT       Yield,fittedvalue,sefittedvalue,residual,seresidual
VFIXEDTESTS [FIXEDTESTS=Drop]
PRINT       Drop[]
VFIXEDTESTS [FIXEDTESTS=Add; WMETHOD=add]
PRINT       Add[]
Updated on June 14, 2019

Was this article helpful?