#=====> cor2icc <=====#
data(apple)
pest <- unique(apple$pesticide)
icc <- rep(-1, length(pest))
for(i in 1:length(pest)){
these <- apple$pesticide == pest[i]
r <- cor(apple$comp[these], apple$ss[these])
icc[i] <- cor2icc(r, 10,"within")
}
names(icc) <- pest
icc
#=====> cdfDist <=====#
par(mfrow=1:2)
F1 <- seq(0.001, 0.999, 0.001)[-sample(999, 300)]
x1 <- exp(quantile(rnorm(10000, 0.5, sd=0.5), F1))
F2 <- seq(0.001, 0.999, 0.001)[-sample(999, 300)]
x2 <- qchisq(F2, mean(x1))
hold <- cdfDist(x1, F1, x2, F2)
plot(hold)
summary(hold)
F1 <- seq(0.001, 0.999, 0.001)[-sample(999, 300)]
x1 <- exp(quantile(rnorm(10000, 0.5, sd=0.5), F1))
F2 <- seq(0.001, 0.999, 0.001)[-sample(999, 300)]
x2 <- qchisq(F2, mean(x1)+1)
hold <- cdfDist(x1, F1, x2, F2)
plot(hold)
summary(hold)
Run the code above in your browser using DataLab