05-31-2017 01:18 PM
I need SAS commands to compare regression slopes, for the following data set,
most apprericated any help...
Options S = 40 LS = 78 NODATE center;
Input Year $ Y X @@;
1YR 3.8 4.5 2YR 6.8 4.5
1YR 6.2 7.5 2YR 15.2 16.5
1YR 7.2 9.5 2YR 8.5 8.0
1YR 8.7 10.5 2YR 9.1 9.5
1YR 10.2 13.0 2YR 12.0 11.5
1YR 13.5 16.0 2YR 12.6 13.0
2YR 13.3 14.0
05-31-2017 01:41 PM
I assume you want a model like this:
proc glm data=Comp; class Year; model Y = X | Year / solution; run;
and then look at the parameter estimates. The estimate for X gives the baseline estimate (for Year=2Yr) and the estimate of the interaction term (X*(Year=1Yr) gives the incremental increase in for the Year=1Yr group.
05-31-2017 04:29 PM
Thanks a lot, for the commands,
I guess I am almost close to the comparsion but not yet though.
I got estimates for different years, but NOT being compared
There letter B in separate columb, it seem there are non-formality implied there?
Source DF Type I SS Mean Square F Value Pr > F X Year X*Year
Source DF Type III SS Mean Square F Value Pr > F X Year X*Year
Parameter Estimate Standard
Error t Value Pr > |t| Intercept X Year 1YR Year 2YR X*Year 1YR X*Year 2YR
looking at a similar question, I found the following commands but not working as it is: what do you think ?
Model Y = X test b=the slope of model A ;
05-31-2017 07:22 PM - edited 05-31-2017 07:44 PM
Sorry, I thought you wanted the values of the slopes. If you want to test whether the slopes are statistically different, you can do a hypothesis test, as described in this SAS Note. For your data it would look like
ESTIMATE '1Yr VS 2Yr' Year 1 -1;
Yes, the "B" indicate the reference levels for the GLM parameterization. You can read about how to interpret the /SOLUTION output in the same SAS note.
05-31-2017 09:13 PM
Thanks once again,
you are very helpful
great reminder of what I was doing years ago, with contrast and estimate
06-01-2017 03:25 PM
I was wondering if I can use estimate or contrast slopes of two years ( B1 vs B2) from regression lines, which are not titled in the data
any comment on these commands :
Model Y = X test b=the slope of model A ;
Yi = B0 + B1x + µ
Yii = B0 + B2x + µ
'B1 vs B2' ??
06-01-2017 03:38 PM
I don't understand why you are now using PROC REG. Perhaps this is a different question. My guess is that you are asking for a hypothesis test to see if it is likely that a parameter estimate equals some value of the parameter. The TEST statement in PROC REG runs an F test for that hypothesis:
proc reg data=sashelp.class plots=none; model weight = height; H4: test height=4; /* F test for H0: b1=4 */ run; quit;
06-01-2017 04:26 PM - edited 06-01-2017 04:27 PM
I'm not sure that this is an answer to the original question, but...to obtain estimates of intercepts and slopes for both regressions (without algebra or ESTIMATE statements) and an easy way to test whether slopes are equal; plus testing slope equal to a particular value:
/* Fit reparameterized ANCOVA model that directly provides estimates of intercepts and slopes. Note use of NOINT in combination with different fixed effects terms. */ proc glimmix data=comp; class year; model y = year x*year / noint solution; estimate "Slope comparison 1YR versus 2YR" x*year 1 -1; store out=comp_model; run; /* Test hypotheses that a particular slope is equal to a particular value */ proc plm restore=comp_model; estimate "1YR slope= 0" x*year 1 / testvalue= 0; /* compare to solution output in model above */ estimate "1YR slope= -3" x*year 1 / testvalue= -3; run;
(I got the PLM tip from Kathleen Kiernan at SAS.)
06-06-2017 02:32 PM
Many thanks to Rick and SLD
I was wondering where I can find more info. on the use of Proc glimix and
Proc plm restore comands
I mean paricularity of their usages in experiment setting and analysis
06-06-2017 02:49 PM
Here are some resource ideas:
1. www.lexjansen.com provides a fabulously easy way to search all of the SAS user group proceedings, including SGF. Try "plm" or "glimmix" in the search window.
2. https://www.sas.com/store/books/categories/usage-and-reference/sas-for-mixed-models-second-edition/p... uses MIXED primarily, but the concepts and usage can be extended to GLIMMIX. The 3rd ed http://support.sas.com/publishing/authors/stroup.html is due out later this year and will feature lots of GLIMMIX.