北京大学 光华管理学院 张峥 实证金融 第四讲

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Proc Means
• <option(s)>
– data=dsn1:含有被分析变量的数据集; – noprint – <statistic-keyword(s)>(主要的作用是控制屏幕输出)
• • • • n:样本数量 mean, var, std, max, min, sum T:t统计量(检验均值为0) Prt:t统计量的P值
proc univariate data=empf.s1 ; var mretwd; by stkcd; run;
Proc Univariate
proc sort data=empf.s1; by stkcd; run; proc univariate data=empf.s1 noprint; var mretwd; by stkcd; output out=sout1 mean=m1 var=v1 ; run; stkcd M1
P1:第1百分位; P10:第10百分位; P90:第90百分位; P95、P99 VAR:样本方差; CV:变异系数 KURTOSIS:峰度 SKEWNESS:偏态 ……
Proc Univariate
• 例:数据集s1中含有两只股票的月度收益率数据, s1有两个变量:股票代码(stkcd)、月份 (trdmnt)、收益率(mretwd)
• Sum the ranks of the positive differences, W+, and sum the ranks of the negative differences W-. • W+ , the sum of the ranks of the positive differences is 2 + 2 + 5· 5 = 9· 5 • W- ,the sum of the ranks of the negative differences is 5· 5 + 9 + 5· 5 + 9 + 2 +5· 5 + 9 = 45· 5
t检验
• 例:上证综合指数月度平均收益率(u)
– H0:u=0 H1:u不等于0 – 数据集:empf.cnaamont – 变量:trdmnt,mretwdeq – proc means data=empf1.cnaamont t prt; – var mretwdeq; – run;
t检验
• 输出结果
E (W ) n(n 1) / 4
u
t n(n 1)(2 n 1) (t t j ) 24 48
j
W n(n 1) / 4
3 j
式中tj(j=1,2,…)为第j个相同秩的个数
符号秩检验
PROC MEANS <option(s)> <statistic-keyword(s)>; BY variables ; VAR variables ; OUTPUT < OUT=SAS-data-set > < keyword1=names...keywordk=names >;
• < options >
– DATA=dsn:指定需要分析的变量所在的数据 集 – Noprint:不在SAS的output窗口输出分析结果
Proc Univariate
• var 变量名1 变量名2 …;
– 指定需要分析的变量;
• by 变量名1 变量名2 …;
– 指定分组变量(注:之前必须按该变量排序)
两样本t检验
• Proc ttest过程首先检验两独立组的方差是否相等, 然后给出方差相等假定满足时的精确两样本t检验 及方差相等条件不满足时的近似检验 • 例:比较上市公司深发展与深万科股票平均月收 益率。
proc ttest data=empf1.s1; class stkcd; var mretwd; run;
V1
000001 000002
均值的检验
• t-test (t检验)
– 大样本(样本量>30)或 – 总体服从正态分布或近似正态
tn 1
x 0 s/ n
Proc Univariate
PROC UNIVARIATE < options > ; BY variables ; VAR variables ; OUTPUT < OUT=SAS-data-set > < keyword1=names...keywordk=names >;
• output out=dsn 统计量关键词=变量名;
– dsn:统计结果输出数据集名称;
Proc Univariate
• 统计量关键词
– – – – – – N:样本个数; Mean:均值; Median:中位数; Mode:众数; Q1:第一四分位(25%) Q3:第三四分位(75%)
– – – – – – – – –
– pearson相关系数:
rxy
(x
i
s xy sx s y
x )( y i y ) n1
s xy
– 相关系数无量纲
相关系数
– +1 a perfect positive linear relationship
– positive a positive linear relationship
检验
独立组 成对组
参数检验
两样本t检验
成对差值t检验
假设
• 独立组:均值相等
H 0 : A B H1 : A B
• 成对组:差值的均值为零
H0 : D 0
H1 : D 0
两样本t检验
• 假设:
– 观测独立 – 每组观测来自正态总体
• 方差相等
t
( X1 X 2 ) t (n1 n2 2) 2 1 s ( 1 ) n1 n2
假设
• 独立组:中位数相等
H0 : M A M B H1 : M A M B
• 成对组:差值的中位数为零
H0 : M D 0
H1 : M D 0
Wilcoxon秩和检验
• 假设观测独立
– – – – proc npar1way data=empf1.s1 wilcoxon; class stkcd; var mretwd; run;
成对差值的t检验与Wilcoxon符号秩检验
• Proc univariate
– Var – Ouput out=dsn 统计关键词=变量名
• 统计关键词
– T、PROBT – SIGNRANK、PROBS
• 例:小公司效应、价值型溢价
关联程度
• 相关系数(Correlation coefficient)
• 例:比较S&P500指数80年代与90年代的月平均收益率水 平
两样本t检验
• 方差不等
( X1 X 2 ) t s12 1 s2 2 1 ) n1 n2
• 例如:Altman and Kishore(1996)
– 债券到期收益率与违约概率、期望回收率有关 – 违约债券的回收率受行业影响,公共事业行业的回收 率高 – 公共事业公司高级债券回收率的标准差低于非公共事 业公司

– The SAS System 20:25 Friday, February 16, 2004 1
– –
– –
The MEANS Procedure Analysis Variable : mretwdeq
t Value Pr > |t| 2.62 0.0098

t检验
• • • • proc means data=empf1.cnaamont noprint; var mretwdeq; output out=sout t=t probt=p; run;
521454163231
– 零假设:,中位数为4 – 备择假设:中位数不等于4
ห้องสมุดไป่ตู้
• Find the difference between each value and the median.
• • • •
Ignore the zeros and rank the absolute values of the remaining scores. Ignoring the zeros leaves you with 10 values. In calculating the ranks, you have four values of 1, three of 2, and three of 3. The three values of 1 occupy the ranks 1, 2, and 3, which has a mean of 2, so they are all given the rank of 2.. • The four values of 2 occupy the ranks 4,5, 6, and 7 which has a mean of 5· 5, and so they are ranked 5· 5. • The three values of 3 have ranks 8, 9, 10 which has a mean of 9; they are all ranked 9.
– Close to zero no linear relationship
– negative a negative linear relationship
– -1 a perfect negative linear relationship
SAS常用过程
第四讲
描述性统计
PROC UNIVARIATE < options > ; BY variables ; VAR variables ; OUTPUT < OUT=SAS-data-set > < keyword1=names...keywordk=names >;
Proc Univariate
• 统计关键词
– T、PROBT
Proc Means
PROC MEANS <option(s)> <statistic-keyword(s)>; BY variables ; VAR variables ; OUTPUT < OUT=SAS-data-set > < keyword1=names...keywordk=names >;
• 统计关键词
– SIGNRANK ,PROBS – H0:总体中位数=0 – H1:总体中位数≠0
两总体均值比较
• 独立组
– 两组独立样本的观测数据 – 例:比较2002年度博时基金管理公司所管理的投资基 金的平均收益率与华夏基金管理公司所管理的基金的 平均收益率的差别
• 成对组
– 每个个体包含成对测量值;以前——以后的测量;例 如,新税法对上市公司股利政策的影响; – 按时间匹配成对;例如,两种投资策略同时期的平均 收益率的差距
Proc Means
• var:指定分析对象 • by:指定分类变量
• output out=dsn2 关键词=新变量名1 新变 量名2 …;
– dsn2:输出结果的数据集 – 关键词:mean, var, std, max, min, T, probt – 新变量:在dsn2中存储关键词指定的统计结果 的变量
检验
独立组 成对组
非参数检验
Wilcoxon秩和 检验
Wilcoxon符号秩检验
Wilcoxon秩和检验
• 不管两个总体分布的形状有无差别,秩和 检验的目的是推断两个总体分布的位置是 否有差别 • 两个总体分布位置不同,实际情况一般是 两个总体分布形状相同或类似,这时可简 化为两个总体中位数的检验
非参数检验
• 基于具体参数分布的统计推断过程,称为 参数方法 • 非参数方法
– 数据难以用任何一个参数模型拟合 – 不对总体分布作具体参数假设情况下的统计推 断
符号秩检验
• Wilcoxon符号秩检验,亦称符号秩检验,用 于样本中位数检验 • 符号秩检验的思想
– 不需要分布形式,假设对称分布 – 假设一组样本为
• Compare the test statistic with the critical value in the tables. • If the null hypothesis were true, and the median is 4, you would expect W+ and W- to have roughly the same value.
相关文档
最新文档