Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用模拟从t表创建线(在R中)_R_Statistics - Fatal编程技术网

使用模拟从t表创建线(在R中)

使用模拟从t表创建线(在R中),r,statistics,R,Statistics,在运行t分布的模拟之后,如何从R中的t表创建一条线?本质上,我希望只使用从正态分布的随机样本计算的值来执行qt函数,而不是使用置信水平作为输入 我已经在t(自由度“df”)分布上运行了5000次模拟,我想获取这些值,并使用它们在t表中重新创建对应于df的线。想弄明白有困难 非常感谢您的帮助 分位数函数将为您提供与我使用的t表中的值相等的值: quants <- 1-c(0.2, 0.1, 0.05, 0.025, 0.01, 0.005, 0.001) n <- 15 sims &

在运行t分布的模拟之后,如何从R中的t表创建一条线?本质上,我希望只使用从正态分布的随机样本计算的值来执行qt函数,而不是使用置信水平作为输入

我已经在t(自由度“df”)分布上运行了5000次模拟,我想获取这些值,并使用它们在t表中重新创建对应于df的线。想弄明白有困难


非常感谢您的帮助

分位数函数将为您提供与我使用的t表中的值相等的值:

quants <- 1-c(0.2, 0.1, 0.05, 0.025, 0.01, 0.005, 0.001)
n <- 15

sims <- replicate( 5000, {x <- rnorm(n); sqrt(n)*mean(x)/sd(x)} )

(t.table <- quantile(sims, quants) )

## compare

rbind( t.table, qt( quants, n-1 ) )

pt(t.table, n-1)
quants