From b17993751440140dbdfae8a180a8137dd029ec55 Mon Sep 17 00:00:00 2001 From: wactbprot <thsteinbock@web.de> Date: Sun, 18 Aug 2013 22:44:29 +0200 Subject: [PATCH] . --- sim/theo.R | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sim/theo.R b/sim/theo.R index 7d931dc..c24ec8a 100644 --- a/sim/theo.R +++ b/sim/theo.R @@ -43,7 +43,7 @@ d <- list( d$m$rand <- rep(NA, d$N) d$c$rand <- rep(NA, d$N) - d$p$rand <- rep(NA, d$N) + d$p$randMean <- rep(NA, d$N) d$t$randMean <- rep(NA, d$N) @@ -59,8 +59,8 @@ d <- list( d$p$lower[i], length.out = d$M) - d$p$rand[i,] <- d$p.pure[i,] + rnorm(d$M, 0, d$p$randSd) - d$t$rand[i,] <- d$t.pure[i,] + rnorm(d$M, 0, d$t$randSd) + d$p$rand[i,] <- d$p$pure[i,] + rnorm(d$M, 0, d$p$randSd) + d$t$rand[i,] <- d$t$pure[i,] + rnorm(d$M, 0, d$t$randSd) temp.lm <- lm( d$p$rand[i,] ~ d$t$rand[i,]) d$c$rand[i] <- coefficients(temp.lm)[1] @@ -78,14 +78,14 @@ d <- list( ### --- plot --- - pt.df <- data.frame(d$p$pure = as.vector(d$p$pure), - d$t$pure = as.vector(d$t$pure), - d$p$rand = as.vector(d$p$rand), - d$t$rand = as.vector(d$t$rand)) + pt.df <- data.frame(d.p.pure = as.vector(d$p$pure), + d.t.pure = as.vector(d$t$pure), + d.p.rand = as.vector(d$p$rand), + d.t.rand = as.vector(d$t$rand)) ggplot(pt.df) + - geom_point(aes(x = d$t$pure, y = d$p$pure), color='black') + - geom_point(aes(x = d$t$rand, y = d$p$rand), color='red') + - geom_abline(aes(intercept = c.rand, slope = m.rand), color='red') + - geom_vline(xintercept = d$t$rand.0, linetype = "longdash") + - geom_point(aes(y = d$p$rand.mean, x = d$t$rand.mean), color="black", size=4) + + geom_point(aes(x = d.t.pure, y = d.p.pure), color='black') + + geom_point(aes(x = d.t.rand, y = d.p.rand), color='red') + + geom_abline(aes(intercept = d$c$rand, slope = d$m$rand), color='red') + + geom_vline(xintercept = d$t$rand0, linetype = "longdash") + + geom_point(aes(y = d$p$randMean, x = d$t$randMean), color="black", size=4) + ggtitle("dp vs. dt") -- GitLab