BookmarkSubscribeRSS Feed
yesa
Calcite | Level 5

Hello,

I ran a linera regression model to test the hypthesis that marginal cost for all the groups are equal. The estimated parameters are different among the groups. I need to test if the estimated parameters  are equivalent to each other. If it is Wald test how can I write the code in SAS enterprise guide?

thanks in advance.

 

18 REPLIES 18
PaigeMiller
Diamond | Level 26

What PROC did you use? Can you show us the code?

--
Paige Miller
yesa
Calcite | Level 5

proc reg data=egen.finaldataenergisteg1;
model InvestKArFP= AInBes1 AInBes2 AInBes3 AInBes4 AInBes5 AInBes6 AInBes8 AInBes9 AInBes10 AInBes11 ;
run;
quit;

Note that may dependent variable is investmentscost and the inpendent variables are dummy variables for energysaving for different groups. If it is group 1 (AInBes1) the dummy variable takes value 1 for group 1 and 0 otherwise. I have ten dummy variables for ten different groups.

I need to test if the estimated pratameters of the dummy variables are equal?

PaigeMiller
Diamond | Level 26

My understanding is this:

 

You want to test if the coefficient of dummy variable AInBes1 is equal to the coefficient of dummy variable AInBes2 and those are equal to the coefficient of dummy variable AInBes3 and so on ...

 

Is that correct?

 

If so, then you don't need dummy variables at all, you need the original category variable which has 11 levels, and which I will assume was named AInBes. Then you can do the test in PROC GLM

 

 

proc glm data=egen.finaldataenergisteg1;
    class AInBes;
    model investkarfp = AInBes;
    means AInBes/t lines;
run; quit;

The test for AInBes is the test you want. If you find that this indicates significant differences between the levels of AInBes, then you can use the results from the MEANS command to determine which levels are different from which other levels.

 

--
Paige Miller
yesa
Calcite | Level 5

I think we have got little missunderstaning here. Rather it might seem that I have made mistake in creating the variables. I have created AInBes1, AInBes2.......AInBes11 by multiplying the  "energisaving" variable with different dummy variables to create an interaction variable. I mean I created dummy variable for each group and then created interaction variable by multiplying these dummy variables with the energisaving variable. And finally the AInBes1, AInBes2.......AInBes11 variables take values either a number for energisaving i kilowatthour or zero otherwise.

 

PaigeMiller
Diamond | Level 26

Minor change to the code I showed. This is what you want:

 

proc glm data=egen.finaldataenergisteg1;
    class AInBes;
    model investkarfp = energisaving*AInBes;
run; quit;

Again, you don't have to create dummy variables. The test for energisaving*ainbes is what you want.

--
Paige Miller
yesa
Calcite | Level 5

I am sorry, I think I was not clear enough to describe my question. At first I want 10 different estimated coefficients för 10 different interaction variables and then I want to test if the estimated coefficients are significantly different from each other. I want to say something about if all the different groups had same marginal investment cost for energysavings measures.

 

PaigeMiller
Diamond | Level 26

One modification, if this doesn't do it, then you will need to describe further, please start by showing us a portion of the data BEFORE you created the dummy variables

 

proc glm data=egen.finaldataenergisteg1;
    class AInBes;
    model investkarfp = energisaving*AInBes/solution;
run; quit;
--
Paige Miller
yesa
Calcite | Level 5
projektInvestKArFPatg_rderInvBesKWhAratgrd1atgrd2atgrd3atgrd4atgrd5atgrd6atgrd7atgrd8atgrd9atgrd10atgrd11AInBes1AInBes2AInBes3AInBes4AInBes5AInBes6AInBes8AInBes9AInBes10AInBes11
P47035-18045,3584711 10000000000          
P47087-175311,326421166000010000000000116600000000000
P47091-125745,147111 10000000000          
P47092-122044,282211245001000000000024500000000000
P47197-11072264,7593 00100000000          
P47262-11101482,69443500000000100000000003500000000000
P47275-1177687,05445 00001000000          
P47276-1631983,158636600000001000000000066000000000000
P47319-1144008,66331140000000000000001000000000400000
P47321-1678855,242962500000000001000000000025000000000
P47422-113692,968442700000100000000007000000000000
P47442-115447,08826164000010000000000640000000000000
P47535-1852807,99791182000001000000000018200000000000000
P47701-125686,322569787550000000010000000007875500
P47702-1157995,789721400000010000000000140000000000000
P47735-136716,08979474600000010000000000746000000000
yesa
Calcite | Level 5

hi again,

I tried to share the part of the data and hope that u can help me now.

PaigeMiller
Diamond | Level 26

I would really like to see the data BEFORE the dummy variables were created, as I'm not going to use them.

--
Paige Miller
yesa
Calcite | Level 5

Hello again,

InvestKArFPatg_rderInvBesKWhAr

are my key variables. The atg_rder variable has values 1 to 11 indicating different measures. I created dummy variables from atg_rder variable taking value 1 if atg_rder is 1 and 0 otherwise, also taking value 1 if atg_rder is 2 and 0 otherwise and so on. Then by multiplying the dummy variables with InvBesKWhAr I created interaction variables.

Then I ran the regression as follows:

proc reg data=egen.finaldataenergisteg1;
model InvestKArFP= AInBes1 AInBes2 AInBes3 AInBes4 AInBes5 AInBes6 AInBes8 AInBes9 AInBes10 AInBes11 ;
run;
quit;

Finally I wanted to test if the coefficents of the interaction variables were significantly different from each other?

 

PaigeMiller
Diamond | Level 26
proc glm data=whatever;
    class atg_rder;
    model investKArFP = atg_rder*invbeskwhar/solution;
run; quit;

The effect for the interaction is the answer you are asking for.

--
Paige Miller
yesa
Calcite | Level 5

Thanks a lot! Now i could get the  estimated coefficients for the interaction variables. But what does the  figure on analysis of Covariance of InvestKArFP variable mean? Can I say anything about if the estimated coefficients are significantly different from each other or not? Sorry that I don't know how to send the results so that you could exp

with best regards.

 
 

 

 

 

 

 

 

PaigeMiller
Diamond | Level 26

You can do a screen capture of the results and then include them in your reply using the "camera" icon (also known as the "insert photos" icon)

--
Paige Miller

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 18 replies
  • 1618 views
  • 0 likes
  • 2 in conversation