Polynomial regression fits the target column to a polynomial expression of the predictor columns. The degree of the polynomial is specified as an input argument to the function.
POLY_REGRESS(options, degree, terms_generated, predictor_field1, predictor_field2, [...,] target_field)
where:
Reserved for future use.
Integer
Is the degree of the polynomial. Low degree polynomials are recommended.
Keyword
Controls the terms that are generated in the polynomial equation.
Numeric
Are at least two predictor field names.
Numeric
Is the target field.
The following scatter plot shows the predicted income values using polynomial regression of degree 4, with predictors education level, and age. The DEFINE FILE command creates virtual fields with correct numeric formats for use in the function.
DEFINE FILE wf_retail EDUC_CODE/I2 TITLE 'Education Code'= DECODE WF_RETAIL_EDUCATION_CUSTOMER.EDUCATION_DEGREE_TYPE ( 'Professional Doctorates' 7, 'Doctorates' 6, 'Master''s Degrees' 5, 'Bachelor''s Degree' 4, 'Associate Degree' 3, 'High School' 2, 'No High School' 1, ELSE 0); END
GRAPH FILE wf_retail
PRINT
AGE
EDUC_CODE
COMPUTE PRED_INCOME/D20.2 =POLY_REGRESS('', 4, ALL_TERMS,
AGE,
EDUC_CODE,
INCOME);
WHERE EDUC_CODE GT 0;
WHERE INCOME GT 12001.00;
WHERE AGE GT 21
ON TABLE PCHOLD
FORMAT JSCHART
ON TABLE SET LOOKGRAPH SCATTER
ON TABLE SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=REPORT, CHART-ORIENTATION=HORIZONTAL, $
TYPE=DATA, COLUMN=N3, BUCKET=Y-AXIS, /*PRED_INCOME*/
$
TYPE=DATA, COLUMN=N1, BUCKET=X-AXIS, /*AGE*/
$
TYPE=DATA, COLUMN=N2, BUCKET=COLOR, /*EDUC_CODE*/
$
ENDSTYLE
END
The output is shown in the following image. Predicted income versus age is plotted, with education level as a parameter visualized by color.
WebFOCUS | |
Feedback |