Frage

Background: I have a categorical variable, X, with four levels that I fit as separate dummy variables. Thus, there are three total dummy variables representing x=1, x=2, x=3 (x=0 is baseline).

Problem/issue: I want to test the significance of a linear combination of my model's parameters, something like: 2*B1+2*B2+B3=0.

In Stata, the first issue can be done easily after a model is fit using the following:

test 2*B1 + 2*B2 + B3 = 0

Now, if I want to do this in SAS for PROC GLM using a CONTRAST statement, I know my "weights" (for lack of a better term) must sum to 0. For example, if, in an unrelated example, I wanted to test the following for four continuous variables: C1 + C2 = C3 + C4, my contrast statement would look like:

CONTRAST 'Contrast1' C1 0.5 C2 0.5 C3 -0.5 C4 -0.5

In this case, it's obvious how each variable should be weighted. However, when I want to combine the coefficients I gave in the model above (2*B1 + 2*B2 + B3 = 0) with these weights, it becomes unclear to me how to weight the function in the CONTRAST statement, specifically for a dummy variable-coded categorical variable, as described initially in the problem.

War es hilfreich?

Lösung

Use PROC REG.

proc reg data=mydata;
model y = b1 b2 b3;
test 2*b1+2*b2+b3=0;
run;
quit;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top