IMSLS_WEIGHTS, floatweights[] (Input) Array with n_observations components containing the array of weights for the observation. Default: weights[] = 1
IMSLS_SSQ_POLY, float**ssq_poly (Output) Address of a pointer to the internally allocated array containing the sequential sums of squares and other statistics. Row i corresponds to xi, i = 0, ..., degree− 1, and the columns are described as follows:
Column
Description
0
degrees of freedom
1
Sums of squares
2
F-statistic
3
p-value
IMSLS_SSQ_POLY_USER, floatssq_poly[] (Output) Storage for array ssq_poly is provided by the user. See IMSLS_SSQ_POLY.
IMSLS_SSQ_POLY_COL_DIM, intssq_poly_col_dim (Input) Column dimension of ssq_poly. Default: ssq_poly_col_dim= 4
IMSLS_SSQ_LOF, float**ssq_lof (Output) Address of a pointer to the internally allocated array containing the lack-of-fit statistics. Row i corresponds to xi, i = 0, ..., degree− 1, and the columns are described in the following table:
Column
Description
0
degrees of freedom
1
lack-of-fit sums of squares
2
F-statistic for testing lack-of-fit for a polynomial model of degree i
3
p-value for the test
IMSLS_SSQ_LOF_USER, floatssq_lof[] (Output) Storage for array ssq_lof is provided by the user. See IMSLS_SSQ_LOF.
IMSLS_SSQ_LOF_COL_DIM, intssq_lof_col_dim (Input) Column dimension of ssq_lof. Default: ssq_lof_col_dim= 4
IMSLS_X_MEAN, float*x_mean (Output) Mean of x.
IMSLS_X_VARIANCE, float*x_variance (Output) Variance of x.
IMSLS_ANOVA_TABLE, float**anova_table (Output) Address of a pointer to the array containing the analysis of variance table.
Column
Description
0
degrees of freedom for the model
1
degrees of freedom for error
2
total (corrected) degrees of freedom
3
sum of squares for the model
4
sum of squares for error
5
total (corrected) sum of squares
6
model mean square
7
error mean square
8
overall F-statistic
9
p-value
10
R2 (in percent)
11
adjusted R2 (in percent)
12
estimate of the standard deviation
13
overall mean of y
14
coefficient of variation (in percent)
Note that the p‑value is returned as 0.0 when the value is so small that all significant digits have been lost.
IMSLS_ANOVA_TABLE_USER, floatanova_table[] (Output) Storage for anova_table is provided by the user. See IMSLS_ANOVA_TABLE.
IMSLS_DF_PURE_ERROR, int*df_pure_error (Output) If specified, the degrees of freedom for pure error are returned in df_pure_error.
IMSLS_SSQ_PURE_ERROR, float*ssq_pure_error (Output) If specified, the sums of squares for pure error are returned in ssq_pure_error.
IMSLS_RESIDUAL, float**residual (Output) Address of a pointer to the array containing the residuals.
IMSLS_RESIDUAL_USER, floatresidual[] (Output) Storage for array residual is provided by the user. See IMSLS_RESIDUAL.
IMSLS_POLY_REGRESSION_INFO, Imsls_f_poly_regression**poly_info (Output) Address of a pointer to an internally allocated structure containing the information about the polynomial fit required as input for IMSL function imsls_f_poly_prediction.
IMSLS_RETURN_USER, floatcoefficients[] (Output) If specified, the least-squares solution for the regression coefficients is stored in array coefficients of size degree + 1 provided by the user.
Description
Function imsls_f_poly_regression computes estimates of the regression coefficients in a polynomial (curvilinear) regression model. In addition to the computation of the fit, imsls_f_poly_regression computes some summary statistics. Sequential sums of squares attributable to each power of the independent variable (stored in ssq_poly) are computed. These are useful in assessing the importance of the higher order powers in the fit. Draper and Smith (1981, pp. 101−102) and Neter and Wasserman (1974, pp. 278−287) discuss the interpretation of the sequential sums of squares. The statistic R2 is the percentage of the sum of squares of y about its mean explained by the polynomial curve. Specifically,
where
is the fitted y value at xi and is the mean of y. This statistic is useful in assessing the overall fit of the curve to the data. R2 must be between 0 and 100 percent, inclusive. R2 = 100 percent indicates a perfect fit to the data.
Estimates of the regression coefficients in a polynomial model are computed using orthogonal polynomials as the regressor variables. This reparameterization of the polynomial model in terms of orthogonal polynomials has the advantage that the loss of accuracy resulting from forming powers of the x-values is avoided. All results are returned to the user for the original model (power form).
Function imsls_f_poly_regression is based on the algorithm of Forsythe (1957). A modification to Forsythe’s algorithm suggested by Shampine (1975) is used for computing the polynomial coefficients. A discussion of Forsythe’s algorithm and Shampine’s modification appears in Kennedy and Gentle (1980, pp. 342−347).
Examples
Example 1
A polynomial model is fitted to data discussed by Neter and Wasserman (1974, pp. 279−285). The data set contains the response variable y measuring coffee sales (in hundred gallons) and the number of self-service coffee dispensers. Responses for 14 similar cafeterias are in the data set. A graph of the results is also given.