Hi All,
I have a 5-yr data on crop rotation. the experiment was a RCBD, there were 12 treatments replicated 4 times ( a total of 48 plots), my yield data are not normally distributed so I am conducting a non-parametric analysis.
I am using proc npar1way (code below).
proc npar1way wilcoxon data = AllYield2015T;
class T_System;
var After_Cleaning;
exact wilcoxon;
run;
And the output (.lst) is:
Sum of Expected Std Dev Mean
T_System N Scores Under H0 Under H0 Score
HIGH DC_W 20 2283.0 1610.0 193.821223 114.150000
HIGH SC_W 20 2713.0 1610.0 193.821223 135.650000
LOW DC_W 20 1797.0 1610.0 193.821223 89.850000
LOW SC_W 20 2138.0 1610.0 193.821223 106.900000
Can anyone please explain to me how to have multiple pairwise Wilcoxon tests, I will like to estimate the significant or non-significant difference between these variable i.e HIGH DC_W vs LOW DC_W etc.
Any help will be greatly appreciated.
Thanks
You will have to do it yourself. It's not that difficult with BY processing. It could go something like:
/* Generate all comparisons (T1 T2 pairs) */
proc sql;
create table comp as
select *
from
(select distinct T_System as T1 from AllYield2015T),
(select distinct T_System as T2 from AllYield2015T)
where T2 > T1;
create table compYield2015T as
select T1, T2, T_system, After_Cleaning
from comp inner join AllYield2015T
on T1 = T_System or T2 = T_System
order by T1, T2, T_System;
quit;
proc npar1way wilcoxon data = compYield2015T;
by T1 T2;
class T_System;
var After_Cleaning;
exact wilcoxon;
ods ouput WilcoxonTest=WT_results;
run;
proc print data=WT_results; run;
/* Correct p values for multiplicity */
... proc multtest ...
(untested)
Hi PG,
Thanks so much. I tried the code but got some errors (below). I am sure I am missing something but I don't know what. I'll appreciate your suggestion. please find attached my SAS CODE .
64 AllYield2015T) where T2 > T1; create table compYield2015T as select T1, T2, T_System, After_Cleaning from comp inner
64 ! join AllYield2015T on T1 = T_System or T2 = T_System order by T1, T2, T_System; quit; proc npar1way wilcoxon data =
64 ! compYield2015T by T1
__
22
ERROR 22-322: Syntax error, expecting one of the following: ;, (, AB, ADJUST, ALPHA, ANOVA, CONOVER, CORRECT, D, DATA, DSCF, EDF,
FP, HL, KLOTZ, KS, KS1, MEDIAN, MISSING, MOOD, NOPRINT, NORMAL, PERM, PLOTS, SAVAGE, SCORES, ST, VW, WILCOXON.
NOTE: Line generated by the invoked macro "ROTATION".
64 AllYield2015T) where T2 > T1; create table compYield2015T as select T1, T2, T_System, After_Cleaning from comp inner
64 ! join AllYield2015T on T1 = T_System or T2 = T_System order by T1, T2, T_System; quit; proc npar1way wilcoxon data =
64 ! compYield2015T by T1
__
202
ERROR 202-322: The option or parameter is not recognized and will be ignored.
WARNING: Output 'WilcoxonTest' was not created. Make sure that the output object name, label, or path is spelled correctly. Also,
verify that the appropriate procedure options are used to produce the requested output object. For example, verify that
the NOPRINT option is not used.
ERROR: File WORK.WT_RESULTS.DATA does not exist.
NOTE: The SAS System stopped processing this step because of errors.
ERROR: INPVALUES= must have the RAW_P variable.
There was a missing semicolon. I fixed the multtest part too.
Thanks a lot PG, it worked and the summary of my results is attached.
1. My interpretation of the result is that the treatments are significantly different with the exception of HIGH DC_W vs LOW DC_W, and LOW DC_W vs LOW SC_W.
2. The analysis did not give me the mean values of the yield, although I have these values in the previous Proc mixed analysis but is it possible to get this in proc npar1way.
Thanks so much.
Nike
NPAR1WAY option ANOVA will give you the means which you can recuperate in ODS OUTPUT table ANOVA.
Hi PG,
Thanks for all the valuable suggestions. Will it be possible for me to run the same analysis on multiple variable?. For instance, I have 3 different depths of nutrient that I wil like to analyse, I used the code below:
create table comp as
select *
from
(select distinct T_System as T1 from AllNutrients), (PG, because the data is on a sheet named AllNutrients)
(select distinct T_System as T2 from AllNutrients)
where T2 > T1;
create table compNutrients as
select T1, T2, T_System, K030, N030, P030 from comp inner join AllNutrients
on T1 = T_System or T2 = T_System
order by T1, T2, T_System;
quit;
proc npar1way wilcoxon data = compNutrients;
by T1 T2;
class T_System;
var K030;
var N030;
var P030;
exact wilcoxon;
ods output WilcoxonTest=WT_results;
run;
proc print data=WT_results;
run;
BUT I KEPT GETTING ERROR, DO I HAVE TO RUN IT SEPARATELY FOR EACH OF THE VARIABLE?.
Your suggestion willbe appreciated.
Thanks.
Have you tried:
proc npar1way wilcoxon data = compNutrients;
by T1 T2;
class T_System;
var K030 N030 P030;
exact wilcoxon;
ods output WilcoxonTest=WT_results;
run;
The documentation at least implies that multiple dependent variables can be included on the VAR statement.
Steve Denham
No, npar1way, as the name sort of implies, is really only good for nonparametric one-way analyses.
If you want to try a distribution-free analysis with fixed and repeated effects, no RANDOM statement, consider rank transforming your results, based on the following:
Brunner, E., Domhof, S., and Langer, F. (2002). Nonparametric Analysis of Longitudinal Data in Factorial Experiments. New York: John Wiley & Sons.
And look at the ANOVAF option in PROC MIXED.
If you do have a RANDOM statement, consider PROC GLIMMIX and using a semiparametric approach, rather than a rank based approach. Ties are not especially friendly to mixed model analyses, and knowing how to rank transform across various levels of random effects is a non-trivial exercise. An approximate method in the case of a single RANDOM effect (such as in a split-plot) is to rank transform all observations.
Steve Denham
Thanks Steve. My case is that I have 5 years factorial experiment. Test for normality within years showed that all my data are normally distributed EXCEPT ONE YEAR. But when I test the data across years (multi) for normality, they were normally distributed.
I did my analysis the first time in proc mixed (code below with input from you Steve),
proc mixed data= AllBiomass;
class Year Rep T_System; (note STEVE, T_System is a combination of my tillage and rotation treatments)
model &var = T_System;
random Rep(year)year year*T_System/solution;
repeated year/subject=rep*T_System type=ar(1) RCORR;
Lsmeans T_System/diff=all;
I feel I should have a second opinion (another SAS procedure) to better explain my findings.
Please do you think I am better off with Proc GLIMMIX or the npar1way is fine.
Your suggestion will be appreciated
Mixed model analyses are robust to minor deviations of normality in the residuals, and it appears that when you fit the repeated measures model, the normality assumption is not violated in any case.
I would not move to a distribution-free (nonparametric in npar1way) or generalized mixed model for these data. The analysis fits the study design and the data meet the assumptions of the analytic method To search for another method looks to me like "venue shopping", or "data dredging", until you get something different.
Steve Denham
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.