- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I need help with fitting a full quadratic model using PROC REG that contains two linear terms (sweetness and moisturecontent), two quadratic terms (sweetness^2 and moisturecontent^2) and the interaction term for the data below.
data brand;
input preference moisturecontent sweetness @@;
if sweetness=2 then dummy=1;
else if sweetness=4 then dummy=0;
dummy_moisture=dummy*moisturecontent;
datalines;
64 4 2 73 4 4 61 4 2 76 4 4 72 6 2 80 6 4
71 6 2 83 6 4 83 8 2 89 8 4 86 8 2 93 8 4
88 10 2 95 10 4 94 10 2 100 10 4
;
run;
proc print;
run;
Please use ONLY PROC REG in explaining.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your last line makes me wonder whether this is for a class? If so, you should say so. It enables the experts to give you hints and suggestions that can lead you towards the answer, instead of solving the problem for you.
You can use the GLMMOD procedure to generate the design matrix that contains the dummy variables.
proc glmmod data=brand outdesign=Design;
model preference = moisturecontent sweetness
moisturecontent*moisturecontent
moisturecontent*sweetness
sweetness*sweetness;
run;
The columns od the DESIGN data set contain the dummy variables, which you can then use in PROC REG:
proc reg data=Design;
model preference = col2-Col6;
quit;
In spite of your admonition to "ONLY [use] PROC REG in explaining," I feel compelled to point out that it is much easier to use PROC GLM and the CLASS statement:
proc glm data=brand ;
model preference = moisturecontent sweetness
moisturecontent*moisturecontent
moisturecontent*sweetness
sweetness*sweetness;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@JUMMY wrote:
Please use ONLY PROC REG in explaining.
I object to this restriction. You are only making life harder for yourself.
So, for anyone else reading along, this should work:
proc glm data=have;
class sweetness;
model preference = sweetness | moisturecontent moisturecontent*moisturecontent;
run;
quit;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@PaigeMiller, I need the diagnostic plots. GLM doesn't help in writing out an equation. There are no coefficients to use in deriving or fitting my model. Thats why I opted for PROC REG please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your last line makes me wonder whether this is for a class? If so, you should say so. It enables the experts to give you hints and suggestions that can lead you towards the answer, instead of solving the problem for you.
You can use the GLMMOD procedure to generate the design matrix that contains the dummy variables.
proc glmmod data=brand outdesign=Design;
model preference = moisturecontent sweetness
moisturecontent*moisturecontent
moisturecontent*sweetness
sweetness*sweetness;
run;
The columns od the DESIGN data set contain the dummy variables, which you can then use in PROC REG:
proc reg data=Design;
model preference = col2-Col6;
quit;
In spite of your admonition to "ONLY [use] PROC REG in explaining," I feel compelled to point out that it is much easier to use PROC GLM and the CLASS statement:
proc glm data=brand ;
model preference = moisturecontent sweetness
moisturecontent*moisturecontent
moisturecontent*sweetness
sweetness*sweetness;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content