diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2017-11-16 14:55:06 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2017-11-16 14:55:06 +0100 |
commit | 76a0aae725f4d603b3c8e8442bb67081891986b4 (patch) | |
tree | 1d4f29bd618c00997a9c1247691d9ad45528724e /R/add_err.R | |
parent | 545d4bdfe1fc532f6d5d1718ee08444430d2976f (diff) |
Add the code used for generating synthetic_data_for_UBA
Static documentation except articles rebuilt by pkgdown
Diffstat (limited to 'R/add_err.R')
-rw-r--r-- | R/add_err.R | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/R/add_err.R b/R/add_err.R index 4d998e94..3b98338d 100644 --- a/R/add_err.R +++ b/R/add_err.R @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 Johannes Ranke +# Copyright (C) 2015-2017 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/> -add_err = function(prediction, sdfunc, +add_err = function(prediction, sdfunc, secondary = c("M1", "M2"), n = 1000, LOD = 0.1, reps = 2, digits = 1, seed = NA) { @@ -33,7 +33,7 @@ add_err = function(prediction, sdfunc, d_rep = data.frame(lapply(d_long, rep, each = 2)) d_rep$value = rnorm(length(d_rep$value), d_rep$value, sdfunc(d_rep$value)) - d_rep[d_rep$time == 0 & d_rep$name %in% c("M1", "M2"), "value"] <- 0 + d_rep[d_rep$time == 0 & d_rep$name %in% secondary, "value"] <- 0 # Set values below the LOD to NA d_NA <- transform(d_rep, value = ifelse(value < LOD, NA, value)) |