I use this code to do multiple linear regression:
PROC REG DATA=WORK.For_Reg
PLOTS(maxpoints=10000)=ALL
;
Linear_Regression_Model:
MODEL Ln_Amount = ABDOM_HERNIA ADD_PROC ADV_DIABETES BLEED_DISORDERS BR_PR_COL_GI_CANCER
CHF_CARDIOMYO_VALVDIS CHRON_RENAL_FAIL CONVULS CP_MS_OTHER DEP_BIPOLAR_PARA DIAG_PROC DIAG_WO_ADD DIAG_W_ADD
DIG_CONG_ANOM DIVERTICULITIS DRUG_REACT DVT_PE GASTRDUO_ULCER GAST_DUODENITIS GI_BLEED GOUT HEP_CIRR_OTR_LIVER IBS
INTEST_INF INTEST_OBSTR MILD_SLEEP_APNEA MORBID_OBESITY NUTR_OTR_ANEMIA OBESITY RESP_FAILURE RHEU_ARTH SCREEN_WO_ADD
SCREEN_W_ADD SHOCK_SYNC STROKE_PARAL TOBACCO
/ SELECTION=BACKWARD
SLS=0.15
INCLUDE=0
STB CORRB CLB
PCORR1 PCORR2
ALPHA=0.1
COLLIN
;
RUN;
QUIT;
I put in 36 independent variables, but SAS dropped 3 vars at the begining, the step 0. Why did sas do that? please see the output.
the output shows:
The model is not of full rank. A subset of model which is of full rank is choosen.
@zhuxiaoyan1 wrote:
I checked. There is only one identical to other one in the model. But I don't know what happened to the other two.
The variables that are causing the problem are identical to linear combinations of other variables.
So if a*X5+b*X6+c*X14 = X1 for any real values of a, b and c, then you will get the same error.
As I said, this modeling would be much better handled by Partial Least Squares regression (PROC PLS) where these (and other) problems go away.
Editor’s Note: This video showing how to build multiple linear regression models with and without interaction may be helpful as well.
How many observations do you have?
Are all your variables continuous or did you create any indicator variables?
ln_amount could easily be loan amount, we can't make inferences based on variable names.
If your variables are indicator variables did you remember to exclude one for each categorical variable?
ie for a variable with 6 categories you only have 5 variables?
To determine which variable is the issue you can run a proc freq between them to do the comparisons.
@zhuxiaoyan1 wrote:
I checked. There is only one identical to other one in the model. But I don't know what happened to the other two.
The variables that are causing the problem are identical to linear combinations of other variables.
So if a*X5+b*X6+c*X14 = X1 for any real values of a, b and c, then you will get the same error.
As I said, this modeling would be much better handled by Partial Least Squares regression (PROC PLS) where these (and other) problems go away.
Editor’s Note: This video showing how to build multiple linear regression models with and without interaction may be helpful as well.
PROC FREQ and you'll have only entries along a diagonal.
Knowing your data - sometimes the same variable is defined multiple ways and included or procedures always go together so including both doesn't make sense.
@Reeza wrote:
PROC FREQ and you'll have only entries along a diagonal.
Knowing your data - sometimes the same variable is defined multiple ways and included or procedures always go together so including both doesn't make sense.
This might find cases where X1=X2, but it won't find cases where a*X1+b*X2+c*X3 = d*X4+e*X5.
PROC PRINCOMP should work, in the above example it will find cases where a*X1+b*X2+c*X3–d*X4+e*X5 has zero variability (or in PROC PRINCOMP language, the component has a zero eigenvalue). And as I have said repeatedly, the use of Partial Least Squares (PROC PLS) avoids this complication entirely.
Adding to my comment above
And as I have said repeatedly, the use of Partial Least Squares (PROC PLS) avoids this complication entirely.
And as I have said repeatedly, the use of Partial Least Squares (PROC PLS) avoids this complication entirely, and has many other benefits when you are trying to model with 36 independent variables.
This is based upon the mathematics of linear regression.
When the message says that the model is not full rank, this means that three of your variables are identical to linear combinations of the other variables, and so cannot be estimated.
You need to determine why your variables are indentical to linear combinations of the other variables, and then delete the variables to eliminate this identicality.
I also add my usual advice against Stepwise regression, and that when you have 36 independent variables, you'd be much better off performing Partial Least Squares regression (PROC PLS), rather than stepwise or ordinary least squares regression.
If you search for "problems with stepwise regression" you will find lots of authors writing on this topic. PLS has been shown to provide better estimates of slopes and predicted values than OLS/stepwise (better meaning lower mean squared error), see http://amstat.tandfonline.com/doi/abs/10.1080/00401706.1993.10485033
You have two questions.
1. You get the error because you have categorical variables that end up being identical
2. Regarding why it dropped three right of the bat - missing data in those variables, or the p-value is less than 0.15 since you set SLS to 0.15. It should produce a table that shows the reason at each step.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.