# dists.2frames

##### Distance between two points

Distance between points specified by rows of two matrices, according to a positive definite matrix. If not specified, the second matrix used is the first.

- Keywords
- array

##### Usage

`dists.2frames(a, b=NULL, A=NULL, A.lower=NULL, test.for.symmetry=TRUE)`

##### Arguments

- a
First dataframe whose rows are the points

- b
Second dataframe whose rows are the points; if

`NULL`

, use`a`

- A
Positive definite matrix; if

`NULL`

, a value for`A.lower`

is needed. If a value for`A`

is supplied, use a clear but possibly slower method- A.lower
The lower triangular Cholesky decomposition of

`A`

(only needed if`A`

is`NULL`

).If a value for

`A.lower`

is specified, this means that a relatively opaque but possibly faster method will be used. The time saving ought to be negligible unless`nrow(a)`

(or`nrow(b)`

if supplied), is huge.**Note that this option does not test for symmetry of matrix A**- test.for.symmetry
Boolean, with default

`TRUE`

meaning to calculate all element arrays (elegantly), and`FALSE`

meaning to calculate only the upper triangular elements (using loops), which ought to be faster. The value of this argument should not affect the returned value, up to numerical accuracy

##### References

M. C. Kennedy and A. O'Hagan 2001.

*Bayesian calibration of computer models*. Journal of the Royal Statistical Society B, 63(3) pp425-464M. C. Kennedy and A. O'Hagan 2001.

*Supplementary details on Bayesian calibration of computer models*, Internal report, University of Sheffield. Available at http://www.tonyohagan.co.uk/academic/ps/calsup.psR. K. S. Hankin 2005.

*Introducing BACCO, an R bundle for Bayesian analysis of computer code output*, Journal of Statistical Software, 14(16)

##### See Also

##### Examples

```
# NOT RUN {
data(toys)
dists.2frames(a=D2.toy,A=diag(2))
A <- diag(2) + matrix(0.2,2,2)
A.lower <- t(chol(A))
jj.1 <- dists.2frames(a=D2.toy, A=A, test=TRUE)
jj.2 <- dists.2frames(a=D2.toy, A=A, test=FALSE)
jj.3 <- dists.2frames(a=D2.toy, A.lower=A.lower, test=FALSE)
jj.4 <- dists.2frames(a=D2.toy, A.lower=A.lower, test=TRUE)
# }
```

*Documentation reproduced from package calibrator, version 1.2-8, License: GPL-2*