Description Usage Arguments Value Examples
Given an output of fitNLSModels
, using a
subset of rows in the original matrix to fit a new NLS model.
This functional is used by shinyapp, not for users.
1 2 3 4 |
x |
a model (i.e. an element of |
include |
which rows should be included |
t |
The time point (hours) |
tcc |
The doubling time of cells. By default this value is Inf, which means the cells are in steady state |
A |
optinal argument for fixed A, if this argument is given, "A" won't be optimized |
B |
optional argument for fixed B, if this argument is given, "B" won't be optimized |
k |
the synthesis/degradation constant |
par.init |
The initial values of parameters to be optimized, it should be list of three elements names as "A", "B" and "k". |
par.lower |
The lower boundary of parameters to be optimized, it should be a numeric values with length 3 and named as "A", "B" and "k". |
par.upper |
The upper boundary of parameters to be optimized, it should be a numeric values with length 3 and named as "A", "B" and "k". |
fitIndividual |
A logical value. When multiple lines are combined to fit a single model (see f),
whether each individual lines should also be fitted. Only used when x is an object of class |
message |
A logical value to indicated if any message should be printed |
a vector of optimized parameters, including A, B, kd, confidence intervals (2.5 mean square error and r-square values. In addition, if individual rows are fitted, the object also contains an attribute stores parameters fitted on each individual row.
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 35 36 | tp <- c(0, 1, 2, 4, 8, 16, 32, 64)
A <- runif(5, min = 0.75, max = 0.95)
B <- runif(5, min = 0.1, max = 0.15)
kd <- runif(5, min = 0.05, max = 0.1)
ds <- mapply(function(A, B, kd) {
degCurve(A=A, B=B, kd=kd, tcc=Inf, t = tp) + rnorm(length(tp), sd = 0.03)
}, A, B, kd)
ds <- t(ds)
ds <- rbind(ds, runif(8, 0, 1))
rf <- c("p1", "p2", "p2", "p3", "p3", "p3")
ss <- fitNLSModels(x = ds, f = rf, t = tp, tcc = Inf, type = "deg",
par.init = list(A=0.8, B=0.2, kd=0.04),
par.lower=c(A=0, B=0, kd=0),
par.upper=c(A=1, B=1, kd=10))
plotCurve.comb(x = ss$list$p3, t = tp, tcc = Inf, curve = "deg")
#' only use the first two rows
res <- refitwoOutlier(x = ss$list$p3, include = 1:2, t = tp, tcc = Inf)
plotCurve.comb(x = res, t = tp, tcc = Inf, curve = "deg")
# synthesis curve
ds2 <- mapply(function(A, B, kd) {
synCurve(A=A, B=B, kd=kd, tcc=Inf, t = tp) + rnorm(length(tp), sd = 0.03)
}, A, B, kd)
ds2 <- t(ds2)
ds2 <- rbind(ds2, runif(8, 0, 1))
ss2 <- fitNLSModels(x = ds2, f = rf, t = tp, tcc = Inf, type = "syn",
par.init = list(A=0.8, B=0.2, ks=0.04),
par.lower=c(A=0, B=0, ks=0),
par.upper=c(A=1, B=1, ks=10))
plotCurve.comb(x = ss2$list$p3, t = tp, tcc = Inf, curve = "syn")
#'#'
res <- refitwoOutlier(x = ss2$list$p3, include = 1:2, t = tp, tcc = Inf)
plotCurve.comb(x = res, t = tp, tcc = Inf, curve = "syn")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.