mylili 1. p = 200 and ¾ = 1:5. The ¯rst 15 covariates (x1; : : : ; x15) and the remaining 185 covarites (x16; : : : ; x200) are independent. The pairwise correlation between the ith and the jth components of (x1; : : : ; x15) is rji¡jj with r = 0:5; i; j = 1; : : : ; 15. The pairwise correlation between the ith and the jth components of (x16; : : : ; x200) is rji¡jj with r = 0:5; i; j = 16; : : : ; 200.Components 1{5 of ¯ are 2.5, components 6{10 are 1.5, components 11{15 are 0.5, and the rest are zero. The covariate matrix has the partial orthogonal structure. 怎么样模拟这个数据呀,求大牛指导
libingfei 你的文章过来的好多乱码,俺只能根据已有的信息猜测。文章大概的意思200个自变量是15个自变量通过协方差检验认为是(除自身所有相关系数均小于某阀值)独立的。其余185个是相关的,采取主成分分析,将185个响量重构成X个正交的新向量。这样可以避免共线性对回归效影响。 你处理这个问题可能用到的函数: cor(cov):计算相关系数 psych包(fa.parallel函数):碎石平行检验,计算合理因子数量 psych包(principal函数):主成分分析函数 predict:模型使用 另外,推荐VIF方差膨胀因子检验,可剔除多重相关
libingfei 首先,很多乱码我看不懂你那个关系是什么? 例如: jj with r = 0:5; i; j = 1; : : : ; 15这句话看不懂。 5 of ¯ are 2.5 看不懂。 最重要的是,模拟出的数据具不具有实际价值。 一般模拟数据至少知道其分布情况,才会有意义。 本人菜鸟一枚,爱莫能助
mylili 回复 第5楼 的 libingfei:我的问题是求一个150*200的矩阵,150是样本数,200是特征数,特征满足(x1, . . . , x15)和(x16, . . . , x200)独立,The pairwise correlation between xi and xj 是ρ的abs(i−j)次方 with ρ = 0.5 当 i, j = 1, . . . , 15 , and 0 for i, j = 16, . . . , 200。 刚入门小硕一枚,请多多指教,[s:11]
mylili 回复 第7楼 的 肖楠:谢谢,你的回复很有用,就是mvrnorm中的sigma是the covariance matrix of the variables,我现在遇到的问题是已知The pairwise correlation between xi and xj 是ρ的abs(i−j)次方 with ρ = 0.5 当 i, j = 1, . . . , 15 , and 0 for i, j = 16, . . . , 200。这个要怎么做呢?[s:13]
libingfei 回复 第10楼 的 mylili: 英文不懂啊,照版主的方法改 你是这个意思? rho = 0.5 sigma = diag(1,200) for (i in 1:15) { for (j in 1:15) { sigma[i, j] = rho^(abs(i - j)) } }