nagdmc basic reg

NAG DMC

Regression: nagdmc basic reg
Purposenagdmc basic reg computes a regression model with p parameters and is a simplified interface tonagdmc linear reg.

Declaration#include <nagdmc.h>void nagdmc basic reg(long rec1, long nvar, long nrec, long dblk, double data[],long nxvar, long xvar[], long yvar, double *R2, double *rms,
long *df, double b[], double se[], double cov[],double model[], int *info);

Parameters1:

rec1 – longInput

On entry: the index in the data of the first data record used in the analysis.
Constraint: rec1 ≥ 0.
2:

nvar – long

Input

On entry: the number of variables in the data.
Constraint: nvar > 1.
3:

nrec – long

Input

On entry: the number of consecutive records, beginning at rec1, used in the analysis.
Constraint: nrec > 1.
4:

dblk – long

Input

On entry: the total number of records in the data block.
Constraint: dblk ≥ rec1 + nrec.
5:

data[dblk ∗ nvar] – double

Input

On entry: the data values for the jth variable (for j = 0, 1, . . . , nvar−1) are stored in data[i∗nvar+j],
for i = 0, 1, . . . , dblk − 1.
6:nxvar – long

Input

On entry: the number of independent variables. If nxvar = 0 then all variables in the data,excluding yvar, are treated as independent variables.
Constraint: 0 ≤ nxvar < nvar.
7:

xvar[nxvar] – long

Input

On entry: the indices indicating the position in data in which values of the independent variables
are stored. If nxvar = 0 then xvar must be 0, and the indices of independent variables are given by
j = 0, 1, . . . , nvar − 1; j 6= yvar.
Constraints: if nxvar > 0, 0 ≤ xvar[i] < nvar, for i = 0, 1, . . . , nxvar − 1; otherwise xvar must be0.
8:yvar – long

Input

On entry: the index in data in which values of the dependent variable are stored.
Constraints: 0 ≤ yvar < nvar; if nxvar > 0, yvar 6= xvar[i], for i = 0, 1, . . . , nxvar − 1.
9:

R2 – double *OutputOn exit: the R2 -value for the fitted model.
10:

rms – double *OutputOn exit: the residual mean square for the fitted model.

nagdmc basic reg.1

nagdmc basic reg

NAG DMC11:

df – long *On exit: the degrees of freedom for the residual mean square.

Output12:b[p] – double
OutputOn exit: the parameter estimates. b[0] is the mean parameter. b[i] is the coefficient of the ith
variable included in the model, for i = 1, 2, . . . , p − 1. If nxvar > 0 then the order the independent
variables are added to the model is defined by xvar, otherwise the order is defined by indices in thedata.

13:

se[p] – double
On exit: the standard errors of the parameters in b.

14:

cov[p ∗ (p + 1)/2] – double
OutputOn exit: the first p ∗ (p + 1)/2 elements of cov contain the upper triangular part of the variancecovariance matrix of the p parameters in b. They are stored packed by column, i.e., the covariance
between the parameter estimate given in b[i] and the parameter estimate given in b[j], j ≥ i, isstored in cov[j(j + 1)/2 + i], for i = 0, 1, . . . , p − 1 and j = i, i + 1, . . . , p − 1.

15:

model[(3 ∗ p ∗ (p + 1))/2 + nvar + 14] – double
OutputOn exit: if not 0, information on the fitted model for use in the functions described in ‘See Also’.

16:

info – int *On exit: info gives information on the success of the function call:

OutputOutput0: the function successfully completed its task.
i; i = 1, 2, . . . , 8: the specification of the ith formal parameter was incorrect.
57: there are no degrees of freedom for the error estimates.
58: the fit is exact, no error estimates.
98: there is an underlying computational problem (this is an unlikely error exit).
99: the function failed to allocate enough memory.

Notation
See the notation for nagdmc linear reg.

Description
See the description for nagdmc linear reg.

References and Further Reading
Draper N R and Smith H (1985) Applied Regression Analysis (2nd Edition) Wiley.
McCullagh P and Nelder J A (1983) Generalized Linear Models Chapman and Hall.
Searle S R (1971) Linear Models Wiley.

See Alsonagdmc extr
nagdmc linear regnagdmc predict reg
nagdmc stepwise reg
basic reg ex.ccomputes fitted values, residuals and leverages for a regression.
linear model with Normal errors.
computes predictions given a fitted regression model.
stepwise linear regression with Normal errors.
the example calling program.

nagdmc basic reg.2