Description Usage Arguments Value Author(s) References See Also Examples
When the distance among any test-retest datatype can be defined, its reliability performed in Xu et al. (2020) can be obtained by this function, to calculate the value of dbICC through the related distance matrix.
1 | dm2icc(dmat, nsub, nmea)
|
dmat |
a distance matrix or an object of |
nsub |
number of subject or individual. |
nmea |
a vector containing number of measurement for each subject or individual;
if |
a scalar, giving the dbICC value
Meng Xu mxu@campus.haifa.ac.il, Philip Reiss
Xu, M., Reiss, P. T., and Cribben, I. (2020). Generalized reliability based on distances. Biometrics, to appear. https://arxiv.org/abs/1912.07137.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ##Point estimates of dbICC
# Generation function for R^2 points from multi-normal distribution
R2gen<-function(nsub,nmea,m=1,variance,sds=NULL,pt=FALSE){
if (is.null(sds)==FALSE) set.seed(sds)
if (length(nmea)==1) nmea<-rep(1,nsub)*nmea
sig1<-diag(rep(variance,2))
mu<-c(0,0)
sig2<-diag(rep(1,2)) # true-value variance of the 2-d normal distribution
t<-MASS::mvrnorm(nsub,mu,sig2)
e<-MASS::mvrnorm(sum(nmea),mu,sig1/m)
p<-matrix(apply(t,2,rep,times=nmea),ncol=2)+e#(I*J)x2
if (pt==TRUE) return(list(t=t,p=p))
if (pt==FALSE) return(p)
}
# set the number of the point
I <- 10
# set the number of the measurement for each point
J <- 4
# generate the sample of R^2 points
varl <- .25 # error variance of the 2-d normal distribution
pij <- R2gen(I,J,variance=varl)
# calculate the squared distance matrix via Euclidean distance
distmat<-as.matrix(dist(pij))
#plot the distance matrix
plotdmat(distmat,I,J)
# dbICC value
dm2icc(distmat,I,J)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.