New Contributor
Posts: 3

# Estimating mean dependent variable value from multivariable linear regression model

I ran a multivariable linear regression model in SAS and got parameter estimates; my model uses compensation as the dependent variable and gender amongst other demographic variables as the predictors.

proc glm;

class race gender rank;

model = total_comp = age race gender rank / solution ss3;

run;

However, I was also hoping to be able to use this model to calculate the mean total compensation using the parameter (coefficient) estimates generated from the above model for men and for women (i.e.m when the independent variable gender=0 and when gender=1).  I am not sure how to program this though -- as I have only been able to see multiple predicted compared to actual values instead of a mean predicted total compensation for each gender category.

Thanks!

Jess

Super User
Posts: 23,720

## Re: Estimating mean dependent variable value from multivariable linear regression model

That's not the code you ran, is it? If not, please post the code and log. You should always have a DATA= and you shouldn't have that first = in the MODEL statement so I wonder if your code ran correctly.

I wonder if an effect plot wouldn't be more useful?

https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html

You can calculate an estimate, but you have to make assumptions regarding race gender and rank. You can assume the reference categories you set - or didn't in this case.  Or you could do it for all and then if you know the N's in your population weight them accordingly? Not sure about the statistical validity of that approach.

Posts: 3,016

## Re: Estimating mean dependent variable value from multivariable linear regression model

jessho wrote:

I ran a multivariable linear regression model in SAS and got parameter estimates; my model uses compensation as the dependent variable and gender amongst other demographic variables as the predictors.

However, I was also hoping to be able to use this model to calculate the mean total compensation using the parameter (coefficient) estimates generated from the above model for men and for women (i.e.m when the independent variable gender=0 and when gender=1).  I am not sure how to program this though -- as I have only been able to see multiple predicted compared to actual values instead of a mean predicted total compensation for each gender category.

Certainly, you could use the LSMEANS statement to obtain the least-squares mean of total_comp for men and for women.

--
Paige Miller
New Contributor
Posts: 3

## Re: Estimating mean dependent variable value from multivariable linear regression model

Thanks, Paige. I tried that, but I could not get the LS Means by gender (nor could I get the 95% confidence intervals).  I coded:

proc glm data=x;

class race gender rank;

model total_comp = age race gender rank / solution;

lsmeans total_comp / cl;

run;

Any sense of what I am coding incorrectly if I want the LSMean for gender=0 and LSMean for gender=1?

Thanks!

Highlighted
Posts: 3,016

## Re: Estimating mean dependent variable value from multivariable linear regression model

http://documentation.sas.com/?cdcId=statcdc&cdcVersion=14.2&docsetId=statug&docsetTarget=statug_glm_...

You want to use

``lsmeans gender/cl;``

--
Paige Miller
Discussion stats
• 4 replies
• 187 views
• 4 likes
• 3 in conversation