Description Usage Arguments Examples
Returns the parameter of the correlation model
1 2 3 4 5 6 7 8 9 10 11 | fitCorModel(h, ...)
## S3 method for class 'numeric'
fitCorModel(h, x, type = "exp", w = NULL, nugget = 0,
smooth = 1, hPred = NULL, startp = NULL, bound = NULL, ...)
## S3 method for class 'matrix'
fitCorModel(x, ...)
## S3 method for class 'formula'
fitCorModel(form, x, ...)
|
h |
Vector of distance |
... |
Other parameters pass to the funtion optim. |
x |
Vector of correlation coefficients or Nx2 matrix of the distance and correlation coefficients. |
type |
Correlation model. See |
w |
Vector of weights. |
nugget |
The nugget parameter. If |
smooth |
The smooth parameter for three parameters model. |
hPred |
A vector of distance for prediction (optional) |
startp |
The starting point for optimization. May be used when the nugget effect is estimated. |
form |
Formula indication the correlation coefficient
and the distance. For instance |
1 2 3 4 5 6 7 8 9 10 11 12 13 | tt = 1:500
rr = corModel(c(200,.1), tt, type = 'exp') +
rnorm(length(tt),0,.2)
df <- data.frame(rho = rr, dist = tt)
fitCorModel(tt, rr, type = 'sph')
sol <- fitCorModel(rho ~ dist, df, nugget = NULL,
type = 'exp', hPred = tt, startp = c(200,.1))
plot(tt,rr, ylab = 'rho', xlab = 'distance')
lines(sol$pred$dist, sol$pred$rho, col = 2, lwd = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.