gmm2d(X, Y, K = 3, gamma = 1, threshold = NULL, initFUN = "initGMM", verbose = FALSE, ...)## S3 method for class 'gmm2d':
plot(x, ...)
## S3 method for class 'gmm2d':
predict(object, ...)
## S3 method for class 'gmm2d':
summary(object, ...)
gmm2d
.ind
that is a vector indicating the order of the rows for which the first K
wilgmm2d
: optional arguments to initFUN
. In the case of plot
: not used. In the case of predict
: N by 2 matrix of grid point locations on which to predict the probability from the 2-d GMM moturboem
function from the For predict.gmm2d, a list is returned with components:
Because the fit is to the locations only, Lakshmanan and Kain (2010) suggest two ways to incorporate intensity information. The first is to repeat points with higher intensities, and the second is to multiply the results by the total intensities over the fields. The points are repeated M times according to the formula (Eq 11 in Lakshmanan and Kain, 2010):
M = 1 + gamma * round( CFD(I_{xy})/frequency(I_MODE)),
where CFD is the cumulative *frequency* distribution (here estimated from the histogram using the
The function gmm2d
fits the 2-d GMM to both fields, plot.gmm2d
first uses predict.gmm2d
to obtain probabilities for each grid point, and then makes a plot similar to those in Lakshmanan and Kain (2010) Figs. 3, 4 and 5, but giving the probabilities instead of the probabilities times A. Note that predict.gmm2d
can be very slow to compute so that plot.gmm2d
can also be very slow. Less effort was put into speeding these functions up because they are not necessary for obtaining results via the parameters. However, they can give the user an idea of how good the fit is.
The 2-d GMM is given by
G(x,y) = A*sum(lambda*f(x,y))
where lambda and f(x,y) are numeric vectors of length K, lambda components describe the mixing, and f(x,y) is the bivariate normal distribution with mean (mu.x, mu.y) and covariance function.
Comparisons between forecast and observed fields are carried out finally by the summary method function. In particular, the translation error
e.tr = sqrt((mu.xf - mu.xo)^2 + (mu.yf - mu.yo)^2),
where f means forecast and o verification fields, resp., and mu .x is the mean in the x- direction, and mu.y in the y- direction. The rotation error is given by
e.rot = (180/pi)*acos(theta),
where theta is the dot product between the first eigenvectors of the covariance matrices for the verification and forecast fields. The scaling error is given by
e.sc = Af*lambda.f/Ao*lambda.o,
where lambda is the mixture component and Af/Ao is the forecast/observed total intensity.
The overall error (Eq 15 of Lakshmanana and Kain, 2010) is given by
e.overall = e1 * min(e.tr/e2, 1) + e3*min(e.rot,180 - e.rot)/e4 + e5*(max(e.sc,1/e.sc)-1),
where e1 to e5 can be supplied by the user, but the defaults are those given by Lakshmanan and Kain (2010). Namely, e1 = 0.3, e2 = 100, e3=0.2, e4 = 90, and e5=0.5.
turboem
, disjointer
, connected
data(ExampleSpatialVxSet)
x <- ExampleSpatialVxSet$vx
xhat <- ExampleSpatialVxSet$fcst
u <- min(quantile(c(x[x > 0]), probs = 0.75),
quantile(c(xhat[xhat > 0]), probs = 0.75))
hold <- gmm2d(x, xhat, threshold=u, verbose=TRUE)
summary(hold)
plot(hold)
data(pert000)
data(pert004)
look <- gmm2d(pert000, pert004, threshold=5, verbose=TRUE)
plot(look) # This will take a long time!
summary(look)
Run the code above in your browser using DataLab