Description Usage Arguments Details Value Author(s) Examples

Some utility functions used internally by higher level `LKrig`

functions. Currently these are simple functions that perform shifts of
a matrix and operations on indices for multidimensional arrays.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
LKrig.shift.matrix( A, shift.row=0, shift.col=0, periodic=c(FALSE, FALSE))
LKrig.rowshift.periodic( A, shift.row)
LKrig.rowshift( A, shift.row, shift.col)
LKArrayShift(A, shift, periodic = FALSE)
expandMatrix0( A, B)
expandMatrix( ...)
expandMList( Mlist, byrow=TRUE)
convertIndexPeriodic(I, nGrid, nPad = NULL)
convertIndexArray(I, nGrid)
grid2Index(I, grid)
``` |

`A` |
A matrix. |

`byrow` |
If TRUE matrices will be repeated row by row. If FALSE this will be done column by column. |

`B` |
Another matrix. |

`grid` |
A vector giving the size of each dimension of array. |

`I` |
A matrix of multidimensional indices where each row identifies an element of the array. e.g. If I[1,] == c( 3,4,2) this refers to A[3,4,2] |

`Mlist` |
A list where each component is a matrix. |

`nGrid` |
A array giving number of elements in each dimension. |

`nPad` |
An array with the number of padding indices in each dimension. |

`periodic` |
A vector of logicals columns.TRUE indicates an index where the shift will be periodic – entries shifted beyond the dimensions will be wrapped to the other side. e.g. for the matrix version c(FALSE, TRUE) indicates the columns of the matrix will be shifted in a periodic way but not the rows. |

`shift` |
A integer vector that gives the shifts for each dimension of the array. |

`shift.row` |
An integer that specifies the number of positions that the rows of the matrix are shifted. |

`shift.col` |
An integer that specifies the number of positions that the columns of the matrix are shifted. |

`...` |
Matrices to be expanded. |

**Shift related:**
These functions are used to create the nearest neighbor indices for
the precision matrices.

**Expand related:**
These functions are useful for creating a sets of covariance parameters that
follow a factorial pattern. For example repeating the rows of the "alpha" parameters
as the "a.wght" parameters are varied. `expandMList`

is particularly useful for creating
a factorial design of parameters to pass to LKrig.MLE for searching the likelihood.

**Index related:**
The function `convertIndexPeriodic`

converts a single index for a multidimensional array, into an index that reflects wrapping into a smaller grid to reflect the padding.
This is used in the `LKDistGrid`

function to handle distances when the grid has periodic dimensions. The other two functions are used for checking and debugging of going back and
forth between the multidimensional and single indexes.

**Shift:**
A matrix of shifted values. Entries that are not defined due to
the shift are set to NA. A column shift is done by a combination of
transpose operations and a row shift.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
A<- matrix( 1:12,3,4)
A
[,1] [,2] [,3] [,4]
[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12
#shift of 2 for rows:
LKrig.rowshift( A, 2)
[,1] [,2] [,3] [,4]
[1,] NA NA NA NA
[2,] NA NA NA NA
[3,] 1 4 7 10
#periodic case
LKrig.rowshift.periodic( A, 2)
[,1] [,2] [,3] [,4]
[1,] 2 5 8 11
[2,] 3 6 9 12
[3,] 1 4 7 10
``` |

**Expand:**
`ExpandMList`

Returns a list of matrices where the original matrices are repeated so that
combinations of rows are represented. The example below illustrates. `byrow=FALSE`

does the repetition
by columns instead of rows.

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 |

Doug Nychka

1 2 3 4 5 6 7 8 9 10 |

LatticeKrig documentation built on May 29, 2017, 7:03 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.