在R中生成多标准数据

时间:2018-11-29 20:23:34

标签: r

我试图使用<onException>ls | sed -e 's/^/"/g' -e 's/$/"/g' | tr '\n' ' ' 中生成多标准数据,但是出现以下错误:

table = bigquery.Table(.........)

external_config = bigquery.ExternalConfig('CSV')
source_uris = ['<url-to-your-external-source>'] #i.e for a csv file in a Cloud Storage bucket 

external_config.source_uris = source_uris
table.external_data_configuration = external_config

但是它对于其他期望和方差都很好,例如

R

否则指定了mvrnorm> epsiloni <- mvrnorm(n = 1, rep(0,8), diag(1), tol = 1e-6, empirical = FALSE, EISPACK = FALSE) Error in mvrnorm(n = 1, rep(0, 8), diag(1), tol = 1e-06, empirical = FALSE, : incompatible arguments

这两者之间的唯一区别只是期望值和方差,但我没有发现betai <- mvrnorm(n = 1, mu, D, tol = 1e-6, empirical = FALSE, EISPACK = FALSE) 中的均值和方差有什么错,它们只是多标准范式。

谢谢!

1 个答案:

答案 0 :(得分:3)

Sigma设置为diag(1)(这是一个1x1矩阵)是问题所在。如果要使用8维向量的单位协方差矩阵,则需要diag(8)

mvrnorm(n = 1, rep(0, 8), diag(8))
# [1] -0.3554192  0.6051595  0.3926595  0.2752819  0.8610572  0.2679094 -1.3581420 -0.2814057