我刚刚碰到了这篇论文,该论文描述了如何通过混合效应建模来计算测量的可重复性(又称可靠性,又称类内相关性)。R代码为: #fit the model fit = lmer(dv~(1|unit),data=my_data) #obtain the variance estimates vc = VarCorr(fit) residual_var = attr(vc,'sc')^2 intercept_var = attr(vc$id,'stddev')[1]^2 #compute the unadjusted repeatability R = intercept_var/(intercept_var+residual_var) #compute n0, the repeatability adjustment n = as.data.frame(table(my_data$unit)) k = nrow(n) N = sum(n$Freq) n0 = (N-(sum(n$Freq^2)/N))/(k-1) #compute the adjusted repeatability Rn = …
我正在寻找KNN归因软件包。我一直在查看插补包(http://cran.r-project.org/web/packages/imputation/imputation.pdf),但是由于某种原因,KNN 插补功能(即使遵循描述中的示例)也似乎归零(如下所示)。我一直在环顾四周,但仍找不到任何东西,因此想知道是否有人对好的KNN插补包有其他建议? w ^ 在下面的代码中-NA值替换为零-不替换为Knn平均值 require(imputation) x = matrix(rnorm(100),10,10) x.missing = x > 1 x[x.missing] = NA kNNImpute(x, 3) x