Next: Time Series Macros Help Up: Regression Macros Help File Previous: testestim()   Contents


yhat() or yhat(Model [,T])

Keywords: glm, regression, anova
yhat(), with no argument, computes a REAL matrix of various quantities
useful in making predictions from a regression or analysis of variance

yhat() uses side effect variables RESIDUALS, HII, etc. produced by the
most recent GLM (generalized linear or linear model) command such as
regress() or anova().  If weights were supplied, it also uses the result
of modelinfo(weights:T).

NOTE: If the most recent GLM was not linear, that is, not regress(),
anova(), manova() or their weighted variants, only the first two columns
computed by yhat() are meaningful.

It is an error if any of the needed side effect variables do not exist.

yhat(Model) first executes manova(Model, silent:T) to compute the side
effect variables and then computes its usual output.  Model should be a
CHARACTER variable or string specifying a linear model.  Any factors in
the model will be treated as factors.

yhat(Model,T) does the same, except any factors in the model are treated
as variates.

Each row of the result corresponds to a case.  When the dependent
variable Y is univariate (has one column), the result has the following
5 columns:
   Col. 1   Y = observed response
   Col. 2   Yhat = predicted or fitted value computed using all data
   Col. 3   Predictive residuals = Y - (Yhat computed excluding the
   Col. 4   SE[Yhat] = estimated standard error of Yhat as estimate of
            E[Y | x]
   Col. 5   SE[pred] = estimated s.e. of prediction error

When the all the independent variables in the model "y=x1+x2+x3+...+xk"
are variates and not factors, columns 2, 4, and 5 of the output
correspond to components 'estimate', 'SEest', and 'SEpred" in the output
of regpred(hconcat(x1,x2,...)) following regress("y=x1+x2+...+xk").  See

When Y is multivariate, with p columns, there are 5*p columns in groups
of p -- the p columns of Y, the p columns of YHat, and so on.

If a case has missing values, most entries will be MISSING and there are
no useful numbers.

  Cmd> yhat("y=x1+x2+x3+x4")

The output of yhat() is modelled on output printed by the yhat() command
in program Multreg.

yhat() is implemented as a pre-defined macro.

See also topics regpred(), 'glm', resid().

Gary Oehlert 2003-01-15