全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
2299 6
2016-10-17
有30个样本量的标准正态检验,次数从10次开始,到110,共100次,给定显著性水平,比较结果,将大于显著性水平的比较次数输出,画出检验次数和比较次数的散点图,一共是100张,怎样合到一张上面去?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-10-17 00:53:52
x=30;h=10;p=0
for(p in 0:99){
n=h+h*p
f=function(x,n,a,mean,sd){
i=1;j=0;k=0;
while(i<=n){
  w=shapiro.test(rnorm(x,mean,sd))
  u=w$p.value
  if(u>a) j=j+1
   else if(u<a) k=k+1
  i=i+1
}
t=j/n
print(n);print(t);
plot(print(n),print(t))
}
f(x,n,0.05,0,1)
p=p+1
}
做出的是100张散点图,怎么合
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-10-17 01:59:31
用par()?
http://www.statmethods.net/advgraphs/layout.html
R makes it easy to combine multiple plots into one overall graph, using either the
par( ) or layout( ) function.
With the par( ) function, you can include the option mfrow=c(nrows, ncols) to create a matrix of nrows x ncols plots that are filled in by row. mfcol=c(nrows, ncols) fills in the matrix by columns.
# 4 figures arranged in 2 rows and 2 columns
attach(mtcars)
par(mfrow=c(2,2))
plot(wt,mpg, main="Scatterplot of wt vs. mpg")
plot(wt,disp, main="Scatterplot of wt vs disp")
hist(wt, main="Histogram of wt")
boxplot(wt, main="Boxplot of wt")
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-10-17 08:14:55
100张散点图合在一张太大了,会导致每一个小图太小,不太好看,至少在图形界面是这样的。除非你用PDF文件保存起来,设置图形文件大小。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-10-17 12:11:01
johnmy 发表于 2016-10-17 01:59
用par()?
http://www.statmethods.net/advgraphs/layout.html
R makes it easy to combine multiple p ...
想过把每次做的结果组成一个矩阵然后提取矩阵中的变量做出图,但是结果没有出来矩阵的形式
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-10-17 12:15:23
johnmy 发表于 2016-10-17 01:59
用par()?
http://www.statmethods.net/advgraphs/layout.html
R makes it easy to combine multiple p ...
x=30;h=10;p=0
for(p in 0:5){
n=h+h*p
f=function(x,n,a,mean,sd){
i=1;j=0;k=0;
while(i<=n){
  w=shapiro.test(rnorm(x,mean,sd))
  u=w$p.value
  if(u>a) j=j+1
   else if(u<a) k=k+1
  i=i+1
}
t=j/n
matrix(c(print(n),print(t)),1,2)
dev.new()
plot(n,t)
}
f(x,n,0.05,0,1)
p=p+1
}
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群