Skip to content

Commit

Permalink
version 0.3-8
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Papritz authored and cran-robot committed Mar 29, 2019
1 parent 71be3ba commit bd00dfd
Show file tree
Hide file tree
Showing 16 changed files with 123 additions and 58 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
Expand Up @@ -526,3 +526,14 @@ processing col and pch arguments
2018-08-27 Andreas Papritz <papritz@env.ethz.ch>

* georob.S3methods.R (add1.georob, drop1.georob, step.georob) elimination of data argument


2018-11-25 Andreas Papritz <papritz@env.ethz.ch>

* georob.simulation.R (f.aux.sim.1) elimination of grid.nodes argument


2019-03-29 Andreas Papritz <papritz@env.ethz.ch>

* georob.private.functions.R (f.aux.gcr) call to RFvariogram{RandomFields, version 3.1} replaced by call to RFfctn{RandomFields, version 3.3}
* georob.simulation.R (condsim) conditioning data is passed as SpatialPointsDataFrame to RFsimulate
10 changes: 5 additions & 5 deletions DESCRIPTION
@@ -1,15 +1,15 @@
Package: georob
Type: Package
Title: Robust Geostatistical Analysis of Spatial Data
Version: 0.3-7
Date: 2018-08-27
Version: 0.3-8
Date: 2019-03-29
Authors@R: c(
person( "Andreas", "Papritz", role = c( "cre", "aut" ),
email = "andreas.papritz@env.ethz.ch" ),
person( "Cornelia", "Schwierz", role = "ctb" ))
Depends: R(>= 2.14.0), parallel, snowfall, sp(>= 0.9-60), stats
Imports: abind, constrainedKriging(>= 0.2-1), fields, lmtest, methods,
nlme, nleqslv, quantreg, RandomFields(>= 3.0.10), robustbase(>=
nlme, nleqslv, quantreg, RandomFields(>= 3.3.6), robustbase(>=
0.90-2)
Suggests: geoR, gstat, multcomp, lattice
Description: Provides functions for efficiently fitting linear models with
Expand All @@ -22,9 +22,9 @@ Description: Provides functions for efficiently fitting linear models with
Kriging predictions of log-transformed data.
License: GPL (>= 2)
NeedsCompilation: no
Packaged: 2018-08-27 18:21:24 UTC; papritz
Packaged: 2019-03-29 15:48:40 UTC; papritz
Author: Andreas Papritz [cre, aut],
Cornelia Schwierz [ctb]
Maintainer: Andreas Papritz <andreas.papritz@env.ethz.ch>
Repository: CRAN
Date/Publication: 2018-08-27 19:02:18 UTC
Date/Publication: 2019-03-29 16:10:02 UTC
30 changes: 15 additions & 15 deletions MD5
@@ -1,30 +1,30 @@
522ba0488556b0fda02a63a13fc5c36a *ChangeLog
7ca58ea0d9abf49632f47c5e74f20f53 *DESCRIPTION
c495d68b9fa7cd72e5c65e9028a77b12 *NAMESPACE
0125da1be2304e5f9db0bb28881d63db *NEWS
8bfcbd8d7d5cdf20e8644956710f2b62 *ChangeLog
79d0d3ca67efc985b4c566cb2dccaade *DESCRIPTION
1bbbbd8d10c38e8072e95e6ec7124bed *NAMESPACE
4b14bc84569226fff150e55321f1c6e1 *NEWS
cf3b31b5c1d9a2523c5b3fad53756e19 *R/georob.S3methods.R
690b7f43f59cff872ae22dba73b4e48b *R/georob.cv.R
f1d1f5a5adb4a085fe41b4d9faace95f *R/georob.exported.functions.R
be29537ab86336681a92df97bbb94023 *R/georob.lgnpp.R
71c52f799f30714f5ac4148820b215a3 *R/georob.predict.R
a4da70c241c5dd02ce9e75a4f6787a2e *R/georob.private.functions.R
53aa2ba7843ce913d4509ef128afacb2 *R/georob.simulation.R
869eb984d6fc82469fb194ecf74453b0 *R/georob.predict.R
6183183fdf66cae67036b5017c5eb484 *R/georob.private.functions.R
d0e7e17d6c095fcbfdb8fc6f32310c7d *R/georob.simulation.R
fe99bbce2cb803b386fb1c916283e6f8 *R/variogram.R
018dbdc6e47c8e326ed72cf4735ae4d2 *build/vignette.rds
59ab64eb12c566599f6eef932e6605ff *build/vignette.rds
831ce9ec4e36d929c6a6fa482f3121db *inst/doc/georob_vignette.R
8ab0a6ade690bbdefe0f2b0d6bb37d12 *inst/doc/georob_vignette.Rnw
ccfd017b418ad6a50c9b8bab92b01b4e *inst/doc/georob_vignette.pdf
a30a7d6fd40888e72c53bc8f30d8ecb3 *inst/doc/georob_vignette.Rnw
145056aae06385afc9a08bbad606d41b *inst/doc/georob_vignette.pdf
2f3793f9b337bf1e73d2df9de6d1d01e *man/compress.Rd
69deb3505141d34494cf09906a169192 *man/control.georob.Rd
7f7a491250c86813ddbd3c174b71f2b4 *man/cv.Rd
da8aade8683a3498bc59a82c9823627c *man/cv.georob.Rd
58ad2f1d46122ba59ebd41680d69bd37 *man/fit.variogram.model.Rd
2c8779efffd16249840853701db29c08 *man/georob.Rd
7c3b5b7d94fb144bdca56a0d77978397 *man/georob.Rd
40e7c3f64dd94b09179f7f84a6bbd698 *man/georobModelBuilding.Rd
4f76714367b5419d4f0feae5b2d8de64 *man/georobObject.Rd
6f561758aef26ff0bae01145a2500293 *man/georobPackage.Rd
bee9ac39f7bae2274ad1eb918c770ad1 *man/georobS3methods.Rd
6b84596d9cfaea3b867c7d786f8cdb4b *man/georobSimulation.Rd
0d5b7a61302f4883503a7979572f07d7 *man/georobSimulation.Rd
bfeffa190c881a7d1559976cce557e7c *man/internal.functions.Rd
020482848aaf4399f6d5187bcfc421cd *man/lgnpp.Rd
6b237a1a67a76099dc74f6d9248caf60 *man/param.defaults.Rd
Expand All @@ -38,7 +38,7 @@ c6c6d5e6ee70c8c1a3ec26aa9ba7815b *man/validate.predictions.Rd
bb27c0989db96d417b6420d1b941bf53 *vignettes/0-block-discretization.pdf
43e94e7c726e507b341dc8dbbab2c3c3 *vignettes/0-overview-zinc-meuse.pdf
fcb9c9341d601d8ed6e6be5066b5c0ba *vignettes/georob.bib
8ab0a6ade690bbdefe0f2b0d6bb37d12 *vignettes/georob_vignette.Rnw
a30a7d6fd40888e72c53bc8f30d8ecb3 *vignettes/georob_vignette.Rnw
ef97150509737b3d7c819a8f5d597538 *vignettes/natbib.bst
5f4e209426d612410a9c56f0618abadb *vignettes/r_coalash_objects.RData
094845e7a8adff61418d2dcf0ed33136 *vignettes/r_meuse_zinc_objects.RData
d0a78cfd6a261091b545dd3b0a84c449 *vignettes/r_coalash_objects.RData
978816df451f639c514f19724bf7782e *vignettes/r_meuse_zinc_objects.RData
2 changes: 1 addition & 1 deletion NAMESPACE
Expand Up @@ -10,7 +10,7 @@ importFrom( methods, slot)
importFrom( nlme, fixef, fixed.effects, ranef, random.effects )
importFrom( nleqslv, nleqslv )
importFrom( quantreg, rq.fit )
importFrom( RandomFields, RFsimulate, RFvariogram, RFoldstyle, RFoptions)
importFrom( RandomFields, RFsimulate, RFfctn, RFoldstyle, RFoptions)
importFrom( robustbase, lmrob.control, lmrob.fit, Qn, robMD, summarizeRobWeights )
# importFrom( nor1mix, norMix, pnorMix, qnorMix, var.norMix )

Expand Down
4 changes: 3 additions & 1 deletion NEWS
Expand Up @@ -14,4 +14,6 @@
2017-05-09 georob Version 0.3-4 released to CRAN, correction of minor bug for computing robust initial values of regression coefficients by rq().
2017-10-20 georob Version 0.3-5 released to CRAN, new function coef().
2018-01-26 georob Version 0.3-6 released to CRAN, new function condsim() for (un)conditional simulation from a fitted georob object.
2018-08-27 georob Version 0.3-6 released to CRAN, minor change of arguments of functions for model building.
2018-08-27 georob Version 0.3-6 released to CRAN, minor change of arguments of functions for model building.
2018-11-25 georob Version 0.3-7 released to CRAN, minor change of function for (conditional) simulation.
2019-03-29 georob Version 0.3-8 released to CRAN, changes required by new version 3.3.6 of package RandomFields
2 changes: 1 addition & 1 deletion R/georob.predict.R
Expand Up @@ -102,7 +102,7 @@ function(
## setup or check contents of variogram.object

if( !all(
is.null(variogram.model), is.null(param), is.null(aniso),
is.null(variogram.model), is.null(param), is.null(aniso),
is.null(variogram.object)
)
){
Expand Down
52 changes: 46 additions & 6 deletions R/georob.private.functions.R
Expand Up @@ -754,6 +754,8 @@ function(
## 2016-08-09 AP changes for nested variogram models
## 2016-08-10 AP changes for isotropic variogram models
## 2017-12-23 AP improved memory management in parallel computations
## 2019-03-29 AP call to RFvariogram{RandomFields, version 3.1} replaced by
## call to RFfctn{RandomFields, version 3.3}

## check consistency of arguments

Expand All @@ -765,8 +767,6 @@ function(
gcr.constant <- as.list( rep( NA_real_, length(variogram.object) ) )
}



res <- lapply(
1L:length(variogram.object),
function( i, x, gcr.constant, lag.vectors, control.pcmp ){
Expand Down Expand Up @@ -805,14 +805,34 @@ function(

## objects s, e, lag.vectors, model.list taken from parent environment

# RandomFields Version 3.1
# result <- try(
# -RFvariogram(
# x = lag.vectors[s[i]:e[i], ], model = model.list,
# dim = attr( lag.vectors, "ndim.coords" ), grid = FALSE
# ),
# silent = TRUE
# )

RFoptions( allow_duplicated_locations = TRUE )

## note: RFfctn computes covariance for stationary and negative
## semivariance for IRF models, required is negative semivariance
result <- try(
-RFvariogram(
RFfctn(
x = lag.vectors[s[i]:e[i], ], model = model.list,
dim = attr( lag.vectors, "ndim.coords" ), grid = FALSE
),
) - model.list[["var"]],
silent = TRUE
)

RFoptions( allow_duplicated_locations = FALSE )

if( !(identical( class( result ), "try-error" ) || any( is.na( result ) )) ){
if(!variogram.model %in% irf.models){
## subtract variance for stationary models
result <- result - model.list[["var"]]
}
result
} else {
"RFvariogram.error"
Expand Down Expand Up @@ -843,14 +863,34 @@ function(

## objects s, e, lag.vectors, model.list taken from parent environment

# RandomFields Version 3.1
# result <- try(
# -RFvariogram(
# x = lag.vectors[s[i]:e[i]], model = model.list,
# grid = FALSE
# ),
# silent = TRUE
# )

RFoptions( allow_duplicated_locations = TRUE )

## note: RFfctn computes covariance for stationary and negative
## semivariance for IRF models, required is negative semivariance
result <- try(
-RFvariogram(
RFfctn(
x = lag.vectors[s[i]:e[i]], model = model.list,
grid = FALSE
),
silent = TRUE
)

RFoptions( allow_duplicated_locations = FALSE )

if( !(identical( class( result ), "try-error" ) || any( is.na( result ) )) ){
if(!variogram.model %in% irf.models){
## subtract variance for stationary models
result <- result - model.list[["var"]]
}
result
} else {
"RFvariogram.error"
Expand Down Expand Up @@ -911,7 +951,7 @@ function(

not.ok <- any( sapply(
Valpha,
function( x ) identical( x, "RFvariogram.error" ) || is.na(x)
function( x ) identical( x, "RFvariogram.error" ) || any(is.na(x))
))

if( !not.ok ){
Expand Down
14 changes: 11 additions & 3 deletions R/georob.simulation.R
Expand Up @@ -50,6 +50,10 @@ condsim <- function(
## parameters estimated by georob for a spatial linear model

## 2018-01-27 A. Papritz
## 2018-11-25 A. Papritz small change in function f.aux.sim.1
## 2019-03-29 A. Papritz restore default for RFoption spConform
## 2019-03-29 A. Papritz conditioning data is passed as SpatialPointsDataFrame to
## RFsimulate (only applies for exact coordinates)


## auxiliary function for aggregating a response variable x for the
Expand Down Expand Up @@ -544,7 +548,6 @@ condsim <- function(

}


## compute (conditional) realizations ...

if( !control[["use.grid"]] ){
Expand Down Expand Up @@ -592,6 +595,7 @@ condsim <- function(

if( control[["condsim"]] ){
data <- cbind( coords.d, values = rep( 0., NROW(coords.d) ) )
coordinates(data) <- colnames(coords.d)
} else {
data <- NULL
}
Expand All @@ -612,7 +616,7 @@ condsim <- function(
tmp <- lapply(
variogram,

function( x, grid.nodes, nsim ){
function( x, nsim ){

signal <- RFsimulate(
model = x[["signal"]], n = nsim,
Expand All @@ -630,7 +634,7 @@ condsim <- function(
signal
}

}, grid.nodes = grid.nodes, nsim = nsim
}, nsim = nsim
)

res <- tmp[[1]]
Expand All @@ -640,6 +644,8 @@ condsim <- function(
}
}

RFoptions( spConform = TRUE )

res

}
Expand Down Expand Up @@ -842,6 +848,8 @@ condsim <- function(
}
}

RFoptions( spConform = TRUE )

res

}
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
22 changes: 12 additions & 10 deletions inst/doc/georob_vignette.Rnw
Expand Up @@ -12,8 +12,9 @@
% 2016-11-14 AP Korrektur Fehler in Rotationsmatrix f\"{u}r geom. anisotrope Variogramme
% 2017-08-11 AP Korrektur von Tippfehlern
% 2017-10-20 AP Korrektur von Fehler bei Plot von Profillikelihood
% 2018-11-16 AP Kleine Erg\"{a}nzung Abschnitt \"{u}ber Berechnung von robusten Startwerten

% cd R.user.home/georob/vignettes/
% cd ~/R.user.home/georob/vignettes/
% R CMD Sweave georob_vignette.Rnw; R CMD Stangle georob_vignette.Rnw; pdflatex georob_vignette.tex; open georob_vignette.pdf;
% bibtex georob_vignette; pdflatex georob_vignette.tex; open georob_vignette.pdf;

Expand Down Expand Up @@ -833,7 +834,7 @@ We now study the \code{summary} output in detail:
% log-likelihood is equal to -54.6.
%
The estimated variogram parameters are reported along with 95\%
confidence intervals that are computed based on the asympotic normal
confidence intervals that are computed based on the asymptotic normal
distribution of (RE)ML estimates from the observed Fisher information.

The dependence of \code{log(zinc)} on \code{sqrt(dist)} is highly
Expand Down Expand Up @@ -871,7 +872,7 @@ waldtest(r.georob.m0.spher.reml, .~.+soil)

\smallskip

Drift models may also be build by stepwise covariate selection based
Drift models may also be build by step-wise covariate selection based
on AIC, either keeping the variogram parameters fixed (default)
%
<<meuse-zinc-georob-reml-step-1,eval=FALSE>>=
Expand Down Expand Up @@ -933,7 +934,7 @@ Variogram: RMspheric
\end{Soutput}
\end{Schunk}
%
which selects the same model. Note that stepwise covariate
which selects the same model. Note that step-wise covariate
selection by \code{step.georob()}, \code{add1.georob()} and
\code{drop1.georob()} requires the \emph{non-restricted}
log-likelihood. Before evaluating candidate models, the initial model
Expand Down Expand Up @@ -1091,7 +1092,7 @@ plot(upr, position=c(2/3, 0, 1, 1), more=FALSE)
@
%
\ecf{Lognormal point Kriging prediction of \code{zinc} (left:
prediction; middle and right: lower and upper bounds of pointwise 95\%
prediction; middle and right: lower and upper bounds of point-wise 95\%
prediction intervals).}{meuse-zinc-point-Kriging-plot}
%

Expand Down Expand Up @@ -1164,7 +1165,7 @@ plot(upr, position=c(2/3, 0, 1, 1), more=FALSE)
%
\ecf{Lognormal block Kriging prediction of \code{zinc} computed under
the assumption of permanence of log-normality (left: prediction; middle
and right: lower and upper bounds of pointwise 95\% prediction
and right: lower and upper bounds of point-wise 95\% prediction
intervals).}{meuse-zinc-block-Kriging-plot}
%

Expand All @@ -1173,7 +1174,7 @@ log-normal laws~---~which strictly cannot hold~---~does not much
impair the efficiency of the back-transformation as long as the blocks
are small \citep{Cressie-2006,Hofer-etal-2013}. However, for
larger blocks, one should use the optimal predictor obtained by
\emph{averaging back-transtransformed point predictions}. \code{lgnpp()}
\emph{averaging back-transformed point predictions}. \code{lgnpp()}
allows to compute this as well. We illustrate this here by predicting
the spatial mean over two larger square blocks:
%
Expand Down Expand Up @@ -2376,9 +2377,10 @@ of initial values than maximizing the Gaussian (restricted)
log-likelihood with respect to the same parameters. If the initial
values for \code{param} and \code{aniso} are not sufficiently close to
the roots of the system of nonlinear equations, then \code{nleqslv()}
may fail to find them. Setting \code{initial.param = TRUE} allows one
to find initial values that are often sufficiently close to the roots
so that \code{nleqslv()} converges. This is achieved by:
may fail to find them. Setting \code{initial.param = TRUE} (see
\code{control.georob()}) allows one to find initial values that are
often sufficiently close to the roots so that \code{nleqslv()}
converges. This is achieved by:

\begin{enumerate}

Expand Down
Binary file modified inst/doc/georob_vignette.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions man/georob.Rd
@@ -1,4 +1,4 @@
% 2015-11-27 A. Papritz
% 2018-11-16 A. Papritz
% R CMD Rdconv -t html -o bla.html georob.Rd ; open bla.html; R CMD Rd2pdf --force georob.Rd;

\encoding{macintosh}
Expand Down Expand Up @@ -356,8 +356,8 @@ georob(formula, data, subset, weights, na.action, model = TRUE,
values for \code{param} and \code{aniso} are not sufficiently close to
the roots of the system of nonlinear equations, then
\code{\link[nleqslv]{nleqslv}} may fail to find them.
Setting
\code{initial.param = TRUE} allows one to find initial values that are
Setting \code{initial.param = TRUE} (see \code{\link{control.georob}})
allows one to find initial values that are
often sufficiently close to the roots so that
\code{\link[nleqslv]{nleqslv}} converges. This is achieved by:

Expand Down

0 comments on commit bd00dfd

Please sign in to comment.