File: RMangle.Rd

package info (click to toggle)
r-cran-randomfields 3.3.14-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,916 kB
  • sloc: cpp: 52,159; ansic: 3,015; makefile: 2; sh: 1
file content (84 lines) | stat: -rw-r--r-- 2,465 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
\name{RMangle}
\alias{RMangle}
\title{Anisotropy matrix given by angle}
\description{
  \command{RMangle} delivers an anisotropy matrix for the
  argument \code{Aniso} in \command{\link{RMmodel}} in two dimensions.
  \command{RMangle} requires one or two stretching values, passed by
  \code{ratio} or \code{diag}, and an \command{angle}.

  In two dimensions and with
  \code{angle} equal to \eqn{a} and \code{diag} equal to \eqn{(d1, d2)} the
  anisotropy matrix \eqn{A} is
  
  \code{A = diag(d1, d2) \%*\% matrix(ncol=2, c(cos(a), sin(a), -sin(a), cos(a)))}

  In three dimensions and with
  \code{angle} equal to \eqn{a}, second angle \eqn{L}
  and \code{diag} equal to \eqn{(d1, d2, d3)} the
  anisotropy matrix \eqn{A} is
 
  \code{A = diag(d1, d2, d3) \%*\% matrix(ncol=3, c(cos(a) * cos(L), sin(a) * cos(L), sin(L), -sin(a), cos(a), 0, -cos(a) * sin(L), -sin(a) * sin(L), cos(L)
    ))}
  i.e. \eqn{Ax} turns a vector x first in the \eqn{x-z} plane, then
  in the \eqn{x-y} plane.
}
 

\usage{
RMangle(angle, lat.angle, ratio, diag) 
}

\arguments{
  \item{angle}{angle \code{a}}
  \item{lat.angle}{second angle; in 3 dimensions only}
 \item{ratio}{equivalent to \code{diag=c(1, 1/ratio)}; in 2 dimensions only}
 \item{diag}{the diagonal components of the matrix}
}

\value{
 \command{\link{RMangle}} returns an object of class \code{\link[=RMmodel-class]{RMmodel}}.
}

\me
\seealso{
 \command{\link{RMtrafo}}, \command{\link{RMmodel}}
  }

\examples{\dontshow{StartExample()}
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again

model <- RMexp(Aniso=RMangle(angle=pi/4, ratio=3))
plot(model, dim=2)

x <- seq(0, 2, 0.05)
z <- RFsimulate(x, x, model=model)
plot(z)


model <- RMexp(Aniso=RMangle(angle=pi/4, lat.angle=pi/8, diag=c(1,2,3)))
x <- seq(0, 2, 0.2)
z <- RFsimulate(x, x, x, model=model)
plot(z, MARGIN.slices=3)


## next model gives an example how to estimate the parameters back
n <- 20
x <- runif(n, 0, 10)
y <- runif(n, 0, 10)
coords <- expand.grid(x, y)
model <- RMexp(Aniso=RMangle(angle=pi/4, diag=c(1/4, 1/12)))
d <- RFsimulate(model, x=coords[, 1], y=coords[, 2], n=10)
estmodel <- RMexp(Aniso=RMangle(angle=NA, diag=c(NA, NA)))
system.time(RFfit(estmodel, data=d, modus_operandi='sloppy'))

\dontshow{FinalizeExample()}}


\keyword{spatial}
\keyword{models}