- 阅读权限
- 255
- 威望
- 1 级
- 论坛币
- 1513 个
- 通用积分
- 280.7625
- 学术水平
- 84 点
- 热心指数
- 107 点
- 信用等级
- 54 点
- 经验
- 9535 点
- 帖子
- 1345
- 精华
- 0
- 在线时间
- 253 小时
- 注册时间
- 2014-12-3
- 最后登录
- 2015-4-3
|
沙发
DM小菜鸟
发表于 2015-2-14 15:27:55
tCopula <- function(param = NA_real_, dim = 2L, dispstr = "ex",
df = 4, df.fixed = FALSE)
{
dim <- as.integer(dim)
stopifnot((pdim <- length(param)) >= 1, is.numeric(param))
if(pdim == 1 && is.na(param)) ## extend it (rho only!)
pdim <- length(param <- rep(param, length.out = npar.ellip(dim, dispstr)))
parameters <- param
param.names <- paste("rho", seq_len(pdim), sep=".")
param.lowbnd <- rep.int(-1, pdim)
param.upbnd <- rep.int( 1, pdim)
if (!df.fixed) { ## df is another parameter __at end__
parameters <- c(parameters, df)
param.names <- c(param.names, "df")
param.lowbnd <- c(param.lowbnd, 1e-6)
param.upbnd <- c(param.upbnd, Inf)
}
new("tCopula",
dispstr = dispstr,
dimension = dim,
parameters = parameters,
df = df,
df.fixed = df.fixed,
param.names = param.names,
param.lowbnd = param.lowbnd,
param.upbnd = param.upbnd,
fullname = paste("t copula family", if(df.fixed) paste("df fixed at", df)),
getRho = function(obj) {
par <- obj@parameters
if (obj@df.fixed) par else par[-length(par)]
}
)
}
把上面那句df改掉,自己赋值
|
|