# SAS/STAT Nonparametric Regression Procedure – PROC GAM

Placement-ready Online Courses: Your Passport to Excellence - Start Now

In our journey of SAS/STAT Tutorials, we learned many types of analysis procedures, today we are going to discuss a SAS/STAT Nonparametric Regression. In this tutorial, we are going to explore the procedures of SAS/STAT Nonparametric Regression: PROC ADAPTIVEREG, PROC GAM, PROC GAMPL, PROC LOESS, and PROC TPSPLINE with examples & syntax.

So, let’s begin with SAS/STAT Nonparametric Regression.

### What is SAS/STAT NonParametric Regression?

SAS/STAT Nonparametric RegressionÂ falls under a category of regressionÂ analysis where the variable that is to be predicted (predictor) does not take a form that is predetermined but, is constructed from information that is derived from the original data.

In SAS/STATÂ nonparametric regression, you do not specify the functional form of your choice. You specify the dependent variable, the outcome, and the covariates. Nonparametric RegressionÂ in SAS/STAT is basically used for prediction, but it is also reliable even if hypotheses of linear regression are not verified.

### Procedures for Non-Parametric Regression in SAS/STAT

Following procedures are used to perform a SAS/STAT Nonparametric Regression of a sample data. Each procedure has a different syntax and is used with different type of data in different contexts. Let us explore each one of these.

#### a. PROC ADAPTIVEREG

The ADAPTIVEREG procedure is useful for building regression models when you have many variables to choose from and the response is either continuous or categorical. It specifically builds nonparametric regression models. It is useful in situations when we want an accurate prediction and the relationship between the predictors and response is unknown.
A Syntax of PROC ADAPTIVEREG-

PROC ADAPTIVEREG DATASET;
Â Class variable;
Â MODEL VARIABLE <options> ;

Â
PROC ADAPTIVEREG Example-

proc adaptivereg data=sashelp.class;
class name;
model age= height weight / dist=normal;
run;

SAS/STAT Nonparametric Regression –Â PROC ADAPTIVEREG

SAS PROC ADAPTIVEREG

#### b. PROC GAM

GAM stands for generalized additive models. It builds models that come under the nonparametric class of regression. In this procedure, there is no assumption of linearity and it is used when the dependent variable is not distributed normally.

A Syntax of PROC GAM-Â

PROC Â GAM dataset <options>;
Â Class < variable> ;
MODEL <dependent variable>;

PROC GAMÂ Example-

proc gam data=sashelp.class;
model age =spline(height)
spline(weight) / dist=normal;
run;

The keyword spline suggests that there could be nonlinearity in the model and the PROC GAM and MODEL statements are required.Â Â  Â  Â

SAS/STAT Nonparametric Regression –Â PROC GAM

SAS/STAT Nonparametric Regression –Â PROC GAM

#### c. PROC GAMPL

The GAMPL provides a model fitting for generalized additive models, which are highly versatile statistical models that find different applications in different industries. These models are basically used for unknown data which is complex and which exhibits non-linear relationships between the response and the predictors.

They can be used for almost all distributions. In SAS/STAT, it can be run in two ways- single machine mode and distributed mode.

A Syntax of PROC GAMPL-

PROC Â GAMPL dataset <options>;
Â Class < variable> ;
Â Model Â response <(response-options)>Â =Â <PARAM(effects)> <spline-effects> </ model-options>;

PROC GAMPLÂ and MODEL statements are required.
PROC GAMPL Example-

ods graphics on;
proc gampl data=sashelp.class plots=all;
model age = param(height weight) spline(height)
spline(weight) / dist=poisson;
run;

SAS Nonparametric Regression –Â PROC GAMPL

SAS Nonparametric Regression –Â PROC GAMPL

SAS Nonparametric Regression –Â PROC GAMPL

#### d. PROC LOESS

The PROC LOESS in SAS/STAT performs nonparametric regression. It makes no assumption of parametric form of regression. This procedure is useful when you donâ€™t know the parametric form of data and when there are too many outliers in the data.
A Syntax of PROC LOESS-

PROC Â LOESS dataset <options>;Â
Â MODEL <options>;

PROC LOESS Example-

ods graphics on;
proc loess data=sashelp.class plots=all;
model age=height;Â Â Â Â Â Â Â Â Â
run;

SASÂ PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

SAS PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

Nonparametric Regression in SAS/STAT – PROC LOESS

#### e. PROC TPSPLINE

The TPSPLINE procedure is used to fit a nonparametric regression model by using the penalized least squares method. It provides options for handling large data sets, supports multiple dependent variables and enables you to choose a particular model by specifying the model degrees of freedom or smoothing parameter.

It fits the data with a flexible model in which the number of effective parameters can be as large as the number of unique design points.
A Syntax of PROC TPSPLINE-

PROC Â TPSPLINE dataset <options>;Â
MODEL dependentsÂ =Â <variables>Â (variables)</ options>;

The PROC TPSPLINE and MODEL statements are required statements.

PROC TPSPLINE Example-

ods graphics on;
proc tpspline data=sashelp.class plots=all;
model age=(height weight)Â  ;Â Â Â Â Â Â Â Â Â
run;

SASÂ PROC TPSPLINE

SAS/STAT Nonparametric Regression –Â PROC TPSPLINE

AS Nonparametric Regression –Â PROC TPSPLINE

Nonparametric Regression in SAS/STAT-Â PROC TPSPLINE

SAS/STAT Nonparametric Regression –Â PROC TPSPLINE

SAS Nonparametric Regression –Â PROC TPSPLINE

Nonparametric Regression in SAS/STAT –Â PROC TPSPLINE

SAS/STAT Nonparametric Regression –Â PROC TPSPLINE

SAS Nonparametric Regression –Â PROC TPSPLINE

SAS Nonparametric Regression –Â PROC TPSPLINE

This was allÂ about SAS/STAT Nonparametric Regression Tutorial. Hope you like our explanation.

### Conclusion

So, this was a complete description and a comprehensive understanding of all the procedures offered by SAS/STAT nonparametric regression. We looked: PROC ADAPTIVEREG, PROC GAM, PROC GAMPL, PROC LOESS, and PROC TPSPLINEÂ with their example & syntax, and how they can be used. Hope you all enjoyed it.

Stay tuned for more interesting topics in SAS/STAT and, for queries, post your doubts in the comments section below.

Did we exceed your expectations?
If Yes, share your valuable feedback on Google