Hello.
I'm Brian Gaines, a developer in the advanced analytics division
and R&D at SAS.
In this video, I'm going to show you
how you can use the Task and SAS Studio to implement
some modern variable selection techniques while harnessing
the power of SAS Viya.
A problem frequently encountered in regression modeling
is determining which predictor variables
to include in your model.
While you may have access to hundreds or thousands
of candidate predictors, often, you
are interested in identifying a subset that contains only
the most relevant variables.
Doing so ensures that the model will be interpretable
so you can easily explain the results to a customer
or colleague.
Also, a simpler model guards against over
fitting the training data, which can
improve predictive accuracy.
As an example, I will be using a data
set from the seminal article on least angle regression, where
the goal is to establish a relationship
between the disease progression in diabetes patients
and several baseline factors.
We have data on 442 diabetes patients and 10 candidate
predictor variables, which include
demographic information, as well as various health measures.
I am using a small data set for the sake of this demonstration,
but the process I am showing you is
the same for much larger data sets, which you can handle
with the power of SAS Viya.
Regardless, the goal is to determine
which of these variables are relevant for predicting
and understanding disease progression in diabetes
patients.
While one way to accomplish this would
be to use theory or domain expertise,
typically, we want to employ an automatic, data driven
technique.
One option would be to use a traditional subset selection
method, but although these methods are very intuitive,
you should use them with caution,
because they do not always have the best performance.
One reason for this is that, because these methods are
discrete processes that either completely include or exclude
a variable at each iteration, their selections are
unstable and highly variable.
A more modern approach to variable selection
is to use a penalized regression method.
These methods introduce a penalty term
that shrinks coefficient estimates towards zero.
This shrinkage effectively performs variable selection
and has been shown to have helpful properties
and good performance.
This selection is done in a continuous manner,
which improves the stability of the results.
This shrinkage of the coefficients
does introduce bias into the coefficient estimates,
but this bias typically improves predictive accuracy
by exploiting the bias variance tradeoff.
Some commonly used penalty methods
include the LASSO and the adaptive LASSO, both of which
are available in the REGSELECT procedure, which
I will be using in our demo.
As I mentioned, I'm going to use the task in SAS Studio
to perform this analysis with the power of SAS Viya.
If you are unfamiliar with SAS Studio,
I encourage you to visit the SAS Studio product
page to learn more about its array of productivity
boosting features.
After opening SAS Studio, to access the task,
you click on the Task icon on the left,
and then expand the SAS Task folder to display
the task developed by SAS.
As you can see, we've developed tasks
that cover a wide range of analytical areas,
including many for SAS Viya.
Your ability to use these tasks will depend on your licensing.
For this example, we are interested in the SAS Viya
Supervised Learning Category, so I click to expand that
and then double click to open the Linear Regression task.
This task, as well as the other Viya task,
requires a connection to a SAS Cloud Analytic Server,
which I have already made.
When you open a task, on the left,
you have the settings and options for the task,
and, at the bottom, there is a Task Console
that lists the items you must address
before you can run the task.
On the right, you have the work area,
which initially consists of comments in the code,
since the minimum requirements for the task
have not been met yet.
The first thing you need to specify is your dataset.
So let's select the diabetes table that has already
been loaded into memory.
Now you need to assign roles to the variables
to be used in your model.
The target variable is the disease progression metric,
which is labeled as y in the dataset.
So let's select that.
For the interval inputs or continuous predictors,
we want to include the rest of the columns in the data table.
So let's use the shortcut at the top
to select all 10 predictors, and then click OK.
After making that selection, you can
see that the code has been automatically
generated in the code window since the task requirements are
now met.
You can see the model statement with y as the target variable,
as well as the input variables that were selected.
Generally, the tasks are designed
so that you need to make only a few selections to be
able to run the task, but the tasks also
provide you with a lot more options
to customize the analysis.
For example, if you go to the Model tab,
you have the option to create a completely customized model.
To see that, let's click Custom Model
and then click Edit to open the Model Effects
Builder, which gives you complete control on specifying
your model.
On the left, there is a list of the input variables
that were selected on the Data tab.
If you click a variable, you can add it
to the model as a main effect, or you can quickly
create polynomial terms by specifying the order.
By selecting multiple variables, you
can also generate cross terms or factorial models.
For example, the journal article included a model
that contained main effects and interactions
for the original covariance.
The model also included squares of nine of the 10 covariance,
with the variable Sex excluded, since it's
an indicator variable.
To create the main effects in interaction terms,
you first select all 10 of the variables
and then click N-Way Factorial and use a value of 2 for n.
These terms are now listed in the Model Effects section.
For the squared terms, let's select
the nine of the 10 variables of interest
and then create polynomial terms with an order of 2.
Click OK to add these effects to the model,
and they now appear in the model statement
of the generated code.
Now that the model has been specified,
you can use the Selection tab to customize
the variable selection process.
There are six different variables selection method
you can use with PROC REGSELECT, including
both traditional methods and more modern methods.
Let's select Adaptive LASSO.
Notice that, after you do that, the code in the code window
automatically updates in real time to reflect this change.
This automatic code generation can be a useful tool
for learning SAS syntax.
There are also additional options
that you can use to adjust how the LASSO is used.
For example, you can use various criteria
to stop the estimation early.
This option can be useful for analyzing large data sets,
since it can avoid estimating the entire LASSO solution
path to reduce the runtime.
You can also choose the criterion
that selects the tuning parameter
to determine the final model.
Let's stick with the defaults and click
Submit to run the task.
In the results, let's scroll down
to see the details of the selection process.
The asterisk denotes the optimal model
that was selected using the SBC criterion,
and the Adaptive LASSO selected four of the possible 64 terms.
The selected predictors include body mass index
and two measures of cholesterol.
From here, you could use the task
to easily see how the results change
when you use different settings or a different selection
method.
You can also edit the generated code
or export the results to various formats, such as PDF or HTML.
As you can see, the task in SAS Studio
enable you to quickly and easily develop code
to perform analytics or taking advantage
of the power of SAS Viya.
For more information, please visit the Visual Data Mining
and Machine Learning product page and the SAS Studio Task
Reference Guide.
Thanks for watching.