Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/main_functions.R
Currently, this function can a field simulate from a regular grid of basis functions with normal errors.
1 2 3 4 |
gridlen |
Length of regular grid. |
coefs |
Numeric vector of coefficients, including intercept term (if no intercept, set first entry to 0). Length of coefs must be equal to nbasis^2. |
shape |
Shape parameter of gamma of weibull distributions. |
rate |
Rate parameter of gamma distribution. |
scale |
Scale parameter of weibull distribution. |
meanlog |
Mean of the normal distribution on the log scale |
sdlog |
Standard deviation of the normal distribution on the log scale |
nbasis |
Number of basis functions to create in 1 dimension (this gets squared if making a field). |
rev |
Logical. Should the direction of the basis functions be reverse? In 1-D, this correspond to letting y=f(-x). |
copula |
Logical. Should 2-D bases be made up of dependent 1-D components? |
copulaType |
A character vector specifying which type of copula should be used to model the dependence when copula = TRUE. Options include "clayton", "frank", "gumbel", "amh", and "joe". These are Archimedean copulas implemented in the copula package. |
param |
Numeric value of the copula dependence parameter. |
errtype |
What sort of error to add to the basis? Currently, only gaussian errors are available. |
errvar |
Numeric specifying the variance of the error distribution. |
Currently no support for irregular grid simulation (aside by selecting some coefficients to be 0).
Matrix corresponding a linear combination of basis functions.
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 | library(VGAM)
set.seed(1)
nbasis <- 40
coefs <- VGAM::rgpd(nbasis^2+1, location = 1, scale = 10, shape = 0.75)
coefs[sample(seq_along(coefs), round(length(coefs)*.3), replace = FALSE)] <- 0
b <- create.weibull.field(80, 1.5, 3, nbasis, rev = TRUE, reduce = TRUE)
pure <- rfield(80, coefs = coefs, shape = 1.5, scale = 3, nbasis = nbasis,
type = "weibull", rev = TRUE, errvar = 0)
noisy <- rfield(80, coefs = coefs, shape = 1.5, scale = 3, nbasis = nbasis,
type = "weibull", rev = TRUE, errvar = 1)
par(mfrow = c(1,3))
contour(b)
contour(pure)
contour(noisy)
coefs2 <- VGAM::rgpd(nbasis^2+1, location = 0, scale = 5, shape = 0.65)
b2 <- create.lognormal.field(100, .5, 3, nbasis, rev=TRUE,reduce=TRUE, copula = TRUE, copulaType = "frank", param = -4)
pure2 <- rfield(80, coefs = coefs2, meanlog = .5, sdlog = 3, nbasis = nbasis,
type = "lognormal", rev = TRUE, copula = TRUE, copulaType = "frank", param = -4, errvar = 0)
noisy2 <- rfield(80, coefs = coefs2, meanlog = .5, sdlog = 3, nbasis = nbasis,
type = "lognormal", rev = TRUE, copula = TRUE, copulaType = "frank", param = -4, errvar = .5)
image(b2^.3, col=colorRampPalette(c("white","blue"))(256), useRaster=TRUE)
image(pure2^.3, col=colorRampPalette(c("white","blue"))(256), useRaster=TRUE)
image(noisy2^.3, col=colorRampPalette(c("white","blue"))(256), useRaster=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.