问题标签 [covariance-matrix]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
r - 方差-协方差矩阵:cov(X) 和 t(X)X(1/n-1) 之间的差异
首先,让我们直截了当地说:我不是数学家或统计学家。
到问题。我想计算一组值的方差-协方差矩阵。这些值存储在矩阵中,例如:
计算方差-协方差矩阵的原因是我想使用 mvrnorm() 来生成模拟的多元数据。在我真正的问题中,我使用 cov() 来做到这一点,效果很好。但是,当我真的想知道如何计算方差-协方差矩阵时,我偶然发现了它的定义,在 R 中实现的应该类似于:
其中 3 是 M 中的 obs(行)数。
但是, (t(M) % % M) (1/(3-1)) 对我来说并没有产生相同的结果。对于真正的问题,它产生的结果与 cov(M) 几乎相似,但并不完全相同。
我在做什么或理解错误?
matlab - 在具有给定协方差矩阵的二维正态分布上生成数字
我想在协方差矩阵 C = [1, 0.8; 的二维正态分布上生成 36 对数字。0.8, 1],期望值向量是零向量(μ=0= (0,0))。
根据我到目前为止所学到的,可以像这样计算具有协方差矩阵 C 的矩阵 A
但是如何在 Matlab 中生成 36 对数字呢?
plm - N = 2 和 T = 60 个四分之一的面板的标准误差 - 使用哪些稳健的标准误差 - vcovHC 或 vcovBK?
对于我的论文,我正在使用 plm 估计不同的固定效应面板回归。该面板是不平衡的,具有较大的 T > N(N = 2,T = 60 年季度),并且是横截面相关的(pcdtest)、自相关的(pgbtest)和异方差的(pbtest)。
我一直在研究很多关于集群标准错误并测试了 vcovHC 和 vcovBK 标准错误,但是我不能 100% 确定在我的情况下使用哪个。
哪些稳健的标准误最适合我的研究环境?
谢谢你的帮助。
r - 在 R 中查找 Iris 数据的协方差矩阵的问题
尝试在 R 中查找 Iris 数据的协方差矩阵时,我不断得到 NA。
python - 基于python的两个非时间矩阵之间的自相关
我试图确定我的两个矩阵是否得到纠正,但我研究的函数似乎是基于时间的:
矩阵 1 是 crack_days_per_year_test (1x20),矩阵 2 是平均高度 (1X20)。这两个数据集之间是否存在相关性或协方差?
lme4 - Convergence issue using a LMM with random intercepts and slopes per patient, and with a continuous AR1 correlation structure
Without providing a reproducible example (because that converged, and my data did not), my data is in a long format and includes 104 patients of which 304 measurements were taken. Most only have 2 measurements (n=68), followed by 5 (n=32), 4 (n=3), 3 (n=1), and 6 measurements (n=1). Some repeated measurements are taken fairly short after each other (for example for 74 of the 304 measurements the time in between was ~0.5 years), where for some patients with only two measurements the time in between is 5 years. The average follow-up time is about 3.5 years.
So far I've modeled a random intercept and slope model:
To further take into account the differing time in between subsequent measurements but keeping the increasing variances over time, I've tried to specify a model with (1) a random intercept, (2) a continuous AR1 correlation structure, and (3) heterogeneous variances:
This model does not converge. As per advice of Ben Bolker previously here is some output from running debug(nlme:::logLik.reStruct)
followed by the following commands:
I understand this question might be difficult to answer without a reproducible example, but posting anymore of my data is not really an option, and model works on the subsets of my data that I had prepared for this question. If anyone has any ideas how I could further diagnose this problem, the help would be very much appreciated!
Update
I've noticed that the problem arises when I specify different variances per week by adding weight=varIdent(form=~1|fu_time)
, and nót per se by adding a continuous AR1 (that works fine). Might the problem be in how many parameters are estimated in the model with heterogenous variances? As in, I thought that that model still only just estimates phi, but now that I think of it it might estimate a parameter for every timepoint, which in my case is a continuous variable with a lot of levels...
sql-server - 在 SQL Server 中查询投资组合 VaR
我正在尝试获取 SQL Server 中的股价(矩阵)日志。列名是动态的,并且已通过应用 PIVOT
现在我必须使用动态列名在此列上应用价格变化日志。
然后我必须应用投资组合协方差
mixed-models - Sommer 包(R 软件)中的多环境试验,误差方差为零
我在 Sommer 包中调整了一个混合模型来解决多环境试验分析,但是当模型收敛时,无论我使用什么约束条件,误差方差始终为零。我正在使用的代码是:
mix<-mmer(Peso~Local:Test + Local, random = ~vs(us(Local),Genotipo) + Local:Bloco, rcov = ~units, data = dados, tolparinv = 0.7)
有人知道如何在 Sommer 中使用此模型进行正确的分析吗?
我有三个环境(本地)在每个环境中测试了大约 250 个基因型(Genotipo)每个环境中的四个块(Bloco)在所有环境中重复大约 20 个检查处理(测试)响应变量是木薯根产量(比索)
python - 如何创建一个 N = 1000 ,二维 2 类数据集给定均值 = [-8,8]T,协方差 = [ [0.3 1.5] [1.5 9.0] ]
生成一个 1000 个二维数据集,X 是两个类和绘图。1 500 个数据向量由均值 m1 = [ 8, 8] T 的高斯分布建模,其余 500 个数据向量由均值 m2 = [ 8, 8] 的高斯分布建模。两种分布的协方差矩阵为 T S = [0.3 1.5 1.5 9.0 ] 使用相同的处方生成另一个数据 200 并创建测试数据集 X 。