Ttest中的SAS条件假设

时间:2015-05-15 19:44:52

标签: sas

var:平均工资。 如果我想对数据运行Ttest而我的HO是70%的员工有超过5000的工资,我如何将70%纳入我的假设?

PROC TTEST DATA=comb5 H0=5000 SIDES=U ALPHA=0.05;
VAR mean_all;
RUN;

1 个答案:

答案 0 :(得分:0)

您实际需要的是一个样本二项式测试,可以在proc freq内完成。您首先需要创建一个标志,显示薪水是否为> 5000,然后你可以对该变量运行二项式测试。

检查online documentation有关可用的不同方法的选项以及如何更改置信区间(默认值为95%)。

/* create dummy dataset */
data have;
call streaminit(123); /* set the randon number seed */
do i = 1 to 1000; /* create 1000 rows */
salary = rand('bernoulli',0.7)+5000; /* create salary (either 5000 or 5001) */
test_flag = (salary>5000); /* create binomial flag to show if salary is > 5000 */
output;
end;
run;

/* run hypothesis that proportion of salaries > 5000 is 0.7 */
proc freq data=have;
table test_flag / binomial (p=0.7 level='1') /* other options available here if required */;
run;