<meta content="text/html; charset=utf-8" http-equiv="Content-Type"></meta><meta content="Word.Document" name="ProgId"></meta><meta content="Microsoft Word 12" name="Generator"></meta><meta content="Microsoft Word 12" name="Originator"></meta><link href="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtmlclip1\08\clip_filelist.xml" rel="File-List"></link><link href="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtmlclip1\08\clip_themedata.thmx" rel="themeData"></link><link href="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtmlclip1\08\clip_colorschememapping.xml" rel="colorSchemeMapping"></link><style> <!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:黑体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimHei; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:"\@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"\@黑体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; mso-ascii-font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-hansi-font-family:"Times New Roman"; mso-font-kerning:0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style>
(5)试画出课程成绩的正态检验的p-p图,看看管理学院2007级学生概率论与数理统计课程成绩是不是接近正态分布。
答案:
> data=read.csv("概率论与数理统计课程成绩数据.csv",head=TRUE)
> attach(data)
> xbar=mean(课程成绩);sdx=sd(课程成绩)
#第一种:粗略画法
> y=sort(课程成绩) #把成绩从小到大排序
> order=c(1:length(课程成绩)) #建立一个数列
> 实际概率=order/length(课程成绩) #粗略计算实际概率(未考虑分数相等情况)
> 理论概率=numeric(length(课程成绩)) #建立理论概率数列
> 理论概率=pnorm(y,xbar,sdx) #计算相应的理论概率
> plot(实际概率,理论概率) #以实际概率为x轴、理论概率为y轴画图
#第二种:准确画法
> y=sort(课程成绩) #把成绩从小到大排序
> order=c(1:length(课程成绩)) #建立一个数列
> n=length(课程成绩)
> for(i in n:2){if(y==y[i-1]) order[i-1]=order}
> 实际概率=order/length(课程成绩) #建立实际概率数列
> 理论概率=numeric(length(课程成绩)) #建立理论概率数列
> 理论概率=pnorm(y,xbar,sdx) #计算相应的理论概率
> plot(实际概率,理论概率) #以实际概率为x轴、理论概率为y轴画图
#第三种:准确画法(利用ecdf函数,Empirical Cumulative Distribution Function:经验分布函数)
> y=sort(课程成绩) #把成绩从小到大排序
> 实际概率函数=ecdf(y) #经验分布函数
> 实际概率=实际概率函数(y) #计算实际概率值
> 理论概率=pnorm(y,xbar,sdx) #计算相应的理论概率
> plot(实际概率,理论概率) #以实际概率为x轴、理论概率为y轴画图