找回密码
 注册
查看: 383|回复: 0

R语言 simecol包 fitOdeModel()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 02:36:48 | 显示全部楼层 |阅读模式
fitOdeModel(simecol)
fitOdeModel()所属R语言包:simecol

                                        Parameter Fitting for odeModel Objects
                                         odeModel对象的参数拟合

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Fit parameters of odeModel objects to measured data.
odeModel对象测量数据的拟合参数。


用法----------Usage----------


fitOdeModel(simObj, whichpar = names(parms(simObj)), obstime, yobs,
  sd.yobs = as.numeric(lapply(yobs, sd)), initialize = TRUE,
  weights = NULL, debuglevel = 0, fn = ssqOdeModel,
  method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "PORT"),
  lower = -Inf, upper = Inf, scale.par = 1,
  control = list(), ...)



参数----------Arguments----------

参数:simObj
a valid object of class odeModel,
一个有效的对象的类odeModel,


参数:whichpar
character vector with names of parameters which are to be optimized (subset of parameter names of the simObj),
字符向量与优化(参数名称的子集的参数名称simObj),


参数:obstime
vector with time steps for which observational data are available,
向量与观测数据的时间步长,


参数:yobs
data frame with observational data for all or a subset of state variables. Their names must correspond exacly with existing names of state variables in the odeModel,
数据框全部或部分状态变量的观测数据。其名称必须符合exacly与现有状态变量的名称在odeModel,


参数:sd.yobs
vector of given standard deviations (or scale) for all observational variables given in yobs.  If no standard deviations (resp. scales) are given, these are estimated from yobs,
矢量给定的标准偏差(或比例)为观测变量在yobs。如果没有标准偏差(或尺度),这些估计yobs


参数:initialize
optional boolean value whether the simObj should be re-initialized after the assignment of new parameter values. This can be necessary in certain models to assign consistent values to initial state variables if they depend on parameters.
可选的布尔值的simObj是否应重新初始化转让后,新的参数值。这可能是必要的,在某些机型到初始状态变量,如果它们依赖于参数指定的值。


参数:weights
optional weights to be used in the fitting process. See cost function (currently only ssqOdeModel) for details.
可选的权重,可以在嵌合过程中使用。有关详细信息,请参阅成本的功能(目前只有ssqOdeModel)。


参数:debuglevel
a positive number that specifies the amount of debugging information printed,
指定的调试信息打印量的正数,


参数:fn
objective function, i.e. function that returns the quality criterium that is minimized, defaults to ssqOdeModel,
目标函数,即函数,返回最小的质量绕圈,默认ssqOdeModel,


参数:method
optimization method, see nlminb for the PORT algorithm and optim for all other methods,
优化方法,请参阅nlminbPORT算法和optim所有其他方法,


参数:lower, upper
bounds of the parameters for method L-BFGS-B, see optim and for method PORT see nlminb. The bounds are also respected by other optimizers by means of an internal transformation of the parameter space (see  p.constrain). In this case, named vectors are required.
L-BFGS-B方法的参数的范围,请参阅optim和方法,的PORT看到nlminb。的界限,也尊重其他优化的内部改造的参数空间(见p.constrain“)。在这种情况下,需要命名矢量。


参数:scale.par
scaling of parameters for method PORT see nlminb.  In many cases, automatic scaling (scale.par = 1) does well, but sometimes (e.g. if parameter ranges differ several orders of magnitude) manual adjustment is required. Often you get a reasonable choice if you set scale.par = 1/upper.  The parameter is ignored by all other methods. For "Nelder-Mead", "BFGS", "CG" and "SANN" parameter scaling occurs as a side effect of parameter transformation with p.constrain.
缩放参数的方法PORTnlminb。在许多情况下,自动缩放(scale.par = 1)做得很好,但有时(例如,如果参数范围相差几个数量级)手动调整。通常,你会得到一个合理的选择,如果你设置scale.par = 1/upper。该参数将被忽略所有其他的方法。对于"Nelder-Mead","BFGS","CG"和"SANN"参数调节发生的副作用参数变换p.constrain。


参数:control
a list of control parameters for optim resp.  nlminb,
控制参数optim RESP的列表。 nlminb,


参数:...
additional parameters passed to the solver method (e.g. to lsoda).
额外的参数传递给求解方法(例如到lsoda)。


Details

详细信息----------Details----------

This function works currently only with odeModel objects where parms is a vector, not a list.
此功能目前只有与odeModel对象的parms是一个矢量,而不是一个列表。

Note also that the control parameters of the PORT algorithm are different from the control parameters of the other optimizers.
还请注意,从其他优化的控制参数的PORT算法的控制参数是不同的。


值----------Value----------

A list with the optimized parameters and other information, see optim resp. nlminb for details.
优化的参数列表和其他信息,请参阅optim RESP。 nlminb的详细信息。


注意----------Note----------

The interface to the PORT algorithm will change for future R versions.
该端口的算法的接口将改变未来的R版本。


参考文献----------References----------

Computing Science Technical Report No. 153. AT&T Bell Laboratories, Murray Hill, NJ.  http://netlib.bell-labs.com/cm/cs/cstr/153.pdf

参见----------See Also----------

ssqOdeModel, optim
ssqOdeModel,optim

Note also that package FME function modFit has even more flexible means to fit model parameters.
还请注意,包FME函数modFit有更灵活的方法来拟合模型参数。

Examples are given in the package vignettes.
例如包中的小插曲。


实例----------Examples----------



## ======== load example model =========[#========负载示例模型=========]
data(chemostat)

#source("chemostat.R")[源(“chemostat.R”)]

## derive scenarios[#导出场景]
cs1 <- cs2 <- chemostat

## generate some noisy data[#产生一些噪声数据]
parms(cs1)[c("vm", "km")] <- c(2, 10)
times(cs1) <- c(from=0, to=20, by=2)
yobs <- out(sim(cs1))
obstime <- yobs$time
yobs$time <- NULL
yobs$S <- yobs$S + rnorm(yobs$S, sd= 0.1 * sd(yobs$S))*2
yobs$X <- yobs$X + rnorm(yobs$X, sd= 0.1 * sd(yobs$X))

## ======== optimize it! =========[#========优化吧! =========]

## time steps for simulation, either small for rk4 fixed step[#模拟时间步长,无论是小RK4固定的步骤]
# times(cs2)["by"] &lt;- 0.1[倍[“”] < -  0.1(CS2)]
# solver(cs2) &lt;- "rk4"[求解器(CS)< - “RK4”]

## or, faster: use lsoda and and return only required steps that are in the data[#或更快:使用lsoda并只返回所需的步骤,在数据]
times(cs2) <- obstime
solver(cs2) <- "lsoda"

## Nelder-Mead (default)[#内尔德酒(默认)]
whichpar  <- c("vm", "km")

res <- fitOdeModel(cs2, whichpar=whichpar, obstime, yobs,
  debuglevel=0,
  control=list(trace=TRUE))

res$par
## assign fitted parameters to the model, i.e. as start values for next step[#分配到模型的拟合参数,即开始下一步的值]
parms(cs2)[whichpar] <- res$par

## alternatively, L-BFGS-B (allows lower and upper bounds for parameters)[#另外,L-BFGS-B(允许上限和下限参数)]
res <- fitOdeModel(cs2, whichpar=c("vm", "km"), obstime, yobs,
  debuglevel=0, fn = ssqOdeModel,
  method = "L-BFGS-B", lower = 0,
  control=list(trace=TRUE),
  atol=1e-4, rtol=1e-4)

res$par

## alternative 2, transform parameters to constrain unconstrained method[2#替代,转换参数,以限制无约束的方法]
## Note: lower and upper are *named* vectors[#注:上限和下限*名为*向量]
res <- fitOdeModel(cs2, whichpar=c("vm", "km"), obstime, yobs,
  debuglevel=0, fn = ssqOdeModel,
  method = "BFGS", lower = c(vm=0, km=0), upper=c(vm=4, km=20),
  control=list(trace=TRUE),
  atol=1e-4, rtol=1e-4)

res$par


## alternative 3a, use PORT algorithm[#替代3A,使用PORT算法]
## Note: lower and upper are *named* vectors[#注:上限和下限*名为*向量]
parms(cs2)[whichpar] <- c(vm=1, km=2)

lower <- c(vm=0, km=0)
upper <- c(vm=4, km=20)

res <- fitOdeModel(cs2, whichpar=c("vm", "km"), obstime, yobs,
  debuglevel=0, fn = ssqOdeModel,
  method = "PORT", lower = lower, upper = upper,
  control=list(trace=TRUE),
  atol=1e-4, rtol=1e-4)

res$par

## alternative 3b, PORT algorithm with manual parameter scaling[#替代3B,PORT手动参数调节算法]
## Note: lower and upper are *named* vectors[#注:上限和下限*名为*向量]

res <- fitOdeModel(cs2, whichpar=c("vm", "km"), obstime, yobs,
  debuglevel=0, fn = ssqOdeModel,
  method = "PORT", lower = lower, upper = upper, scale.par = 1/upper,
  control=list(trace=TRUE),
  atol=1e-4, rtol=1e-4)

res$par

## set model parameters to  fitted values and simulate again[#设置模型参数拟合值和模拟再次]
parms(cs2)[whichpar] <- res$par
times(cs2) <- c(from=0, to=20, by=1)
ysim <- out(sim(cs2))

## plot results[#图谋结果的]
par(mfrow=c(2,1))
plot(obstime, yobs$X, ylim = range(yobs$X, ysim$X))
lines(ysim$time, ysim$X, col="red")
plot(obstime, yobs$S, ylim= range(yobs$S, ysim$S))
lines(ysim$time, ysim$S, col="red")


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-24 04:00 , Processed in 0.023406 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表