[spcopula-commits] r115 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 20 16:27:22 CET 2013


Author: ben_graeler
Date: 2013-11-20 16:27:22 +0100 (Wed, 20 Nov 2013)
New Revision: 115

Removed:
   pkg/man/getNeighbours.experimental.Rd
Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/BB7copula.R
   pkg/R/spatialPreparation.R
Log:
- made getNeighbours.experimental the "default"
- corrected boundaries for r270BB7Copula

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2013-11-20 09:20:38 UTC (rev 114)
+++ pkg/DESCRIPTION	2013-11-20 15:27:22 UTC (rev 115)
@@ -2,12 +2,12 @@
 Type: Package
 Title: copula driven spatial analysis
 Version: 0.1-1
-Date: 2013-11-19
+Date: 2013-11-20
 Authors at R: c(person("Benedikt", "Graeler", role = c("aut", "cre"), email =
         "ben.graeler at uni-muenster.de"), person("Marius", "Appel",
         role = "ctb"))
 Maintainer: Benedikt Graeler <ben.graeler at uni-muenster.de>
-Description: This package provides a framework to analyse via copulas spatial and spatio-temporal data provided in the format of the spacetime package. Additionally, support for calculating different multivariate return periods is implemented.
+Description: This package provides a framework to analyse via copulas spatial and spatio-temporal data provided in the format of sp and spacetime package respectively. Additionally, support for calculating different multivariate return periods is implemented.
 License: GPL-2
 LazyLoad: yes
 Depends: copula (>= 0.999-7), R (>= 2.15.0)

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2013-11-20 09:20:38 UTC (rev 114)
+++ pkg/NAMESPACE	2013-11-20 15:27:22 UTC (rev 115)
@@ -30,7 +30,7 @@
 # export(setSizeLim)
 
 # spatial
-export(getNeighbours,getNeighbours.experimental, getStNeighbours)
+export(getNeighbours, getStNeighbours)
 export(calcBins)
 export(calcSpTreeDists, dropSpTree)
 

Modified: pkg/R/BB7copula.R
===================================================================
--- pkg/R/BB7copula.R	2013-11-20 09:20:38 UTC (rev 114)
+++ pkg/R/BB7copula.R	2013-11-20 15:27:22 UTC (rev 115)
@@ -225,7 +225,7 @@
   if (any(is.na(param) | param[1] > -1 | param[2] >= 0 | param <= c(-Inf,-Inf)))
     stop(paste("Parameter values out of bounds: theta: (-Inf,-1], delta: (-Inf,0)."))
   new("r270BB7Copula", dimension = as.integer(2), parameters = param, 
-      param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(-1, -1), 
+      param.names = c("theta", "delta"), param.lowbnd = c(-Inf, -Inf), param.upbnd = c(-1, 0), 
       family=39, fullname = "270 deg rotated BB7 copula family. Number 39 in VineCopula.")
 }
 

Modified: pkg/R/spatialPreparation.R
===================================================================
--- pkg/R/spatialPreparation.R	2013-11-20 09:20:38 UTC (rev 114)
+++ pkg/R/spatialPreparation.R	2013-11-20 15:27:22 UTC (rev 115)
@@ -58,49 +58,49 @@
 # returns an neighbourhood object
 ##################################
 
-getNeighbours <- function(dataLocs, predLocs, var=names(dataLocs)[1], size=5, 
-                          prediction=FALSE, min.dist=0.01) {
-  
-  stopifnot((!prediction && missing(predLocs)) || (prediction && !missing(predLocs)))
-  stopifnot(min.dist>0 || prediction)
-  
-  if(missing(predLocs) && !prediction)
-    predLocs=dataLocs
-  
-  stopifnot(is(predLocs,"Spatial"))
-  
-  if(any(is.na(match(var,names(dataLocs)))))
-    stop("At least one of the variables is unkown or is not part of the data.")
+# getNeighbours <- function(dataLocs, predLocs, var=names(dataLocs)[1], size=5, 
+#                           prediction=FALSE, min.dist=0.01) {
+#   
+#   stopifnot((!prediction && missing(predLocs)) || (prediction && !missing(predLocs)))
+#   stopifnot(min.dist>0 || prediction)
+#   
+#   if(missing(predLocs) && !prediction)
+#     predLocs=dataLocs
+#   
+#   stopifnot(is(predLocs,"Spatial"))
+#   
+#   if(any(is.na(match(var,names(dataLocs)))))
+#     stop("At least one of the variables is unkown or is not part of the data.")
+# 
+#   nLocs <- length(predLocs)
+#   size <- min(size, length(dataLocs)+prediction)
+#   
+#   allLocs <- matrix(NA,nLocs,size)
+#   allDists <- matrix(NA,nLocs,size-1)
+#   allData <- matrix(NA,nLocs,size)
+#   for (i in 1:nLocs) {
+#     tempDists <- spDists(dataLocs, predLocs[i, ])
+#     tempDists[tempDists < min.dist] <- Inf
+#     spLocs <- order(tempDists)[1:(size - 1)]
+#     
+#     allLocs[i,] <- c(i, spLocs)
+#     allDists[i,] <- tempDists[spLocs]
+#     allData[i,(prediction+1):size] <- dataLocs[c(i[!prediction],spLocs),
+#                                                var, drop = F]@data[[1]]
+#   }
+#   
+#   if (!prediction)
+#     predLocs <- NULL
+#   colnames(allData) <- paste(paste("N", rep(0:(size-1), 
+#                                             each=length(var)), sep=""),
+#                              rep(var,size),sep=".")
+#   return(neighbourhood(allData, allDists, allLocs, dataLocs,
+#                        predLocs, prediction, var))
+# }
+# 
 
-  nLocs <- length(predLocs)
-  size <- min(size, length(dataLocs)+prediction)
-  
-  allLocs <- matrix(NA,nLocs,size)
-  allDists <- matrix(NA,nLocs,size-1)
-  allData <- matrix(NA,nLocs,size)
-  for (i in 1:nLocs) {
-    tempDists <- spDists(dataLocs, predLocs[i, ])
-    tempDists[tempDists < min.dist] <- Inf
-    spLocs <- order(tempDists)[1:(size - 1)]
-    
-    allLocs[i,] <- c(i, spLocs)
-    allDists[i,] <- tempDists[spLocs]
-    allData[i,(prediction+1):size] <- dataLocs[c(i[!prediction],spLocs),
-                                               var, drop = F]@data[[1]]
-  }
-  
-  if (!prediction)
-    predLocs <- NULL
-  colnames(allData) <- paste(paste("N", rep(0:(size-1), 
-                                            each=length(var)), sep=""),
-                             rep(var,size),sep=".")
-  return(neighbourhood(allData, allDists, allLocs, dataLocs,
-                       predLocs, prediction, var))
-}
 
-
-
-getNeighbours.experimental = function (dataLocs, predLocs, var = names(dataLocs)[1], size = 5, 
+getNeighbours <- function (dataLocs, predLocs, var = names(dataLocs)[1], size = 5, 
 									   prediction = FALSE, min.dist = 0.01) 
 {
   stopifnot((!prediction && missing(predLocs)) || (prediction && 
@@ -142,16 +142,6 @@
                         predLocs, prediction, var))
 }
 
-
-
-
-
-
-
-
-
-
-
 #############
 ## BINNING ##
 #############

Deleted: pkg/man/getNeighbours.experimental.Rd
===================================================================
--- pkg/man/getNeighbours.experimental.Rd	2013-11-20 09:20:38 UTC (rev 114)
+++ pkg/man/getNeighbours.experimental.Rd	2013-11-20 15:27:22 UTC (rev 115)
@@ -1,49 +0,0 @@
-\name{getNeighbours.experimental}
-\alias{getNeighbours.experimental}
-
-\title{
-Creating Local Neighbourhoods
-}
-\description{
-This function calculates a local neighbourhood to be used for fitting of spatial/spatio-temporal vine copulas and for prediction using spatial/spatio-temporal vine copulas.
-}
-\usage{
-getNeighbours.experimental(dataLocs, predLocs, var = names(dataLocs)[1], size = 5,
-prediction=FALSE, min.dist = 0.01)
-}
-\arguments{
-  \item{dataLocs}{
-some spatial data frame holding the data used for estimation/prediction
-}
-  \item{predLocs}{
-A spatial object defining the prediction locations, might be missing if the neighbourhood is used for fitting.
-}
-  \item{var}{
-the variable name of interest, by default the first variable is used.
-}
-  \item{size}{
-The size of the neighbourhood including the location of interest (for fitting as well for prediction).
-}
-  \item{prediction}{whether the neighbourhood should be used for prediction (TRUE) or spatial/Spatio-temporal vine copula fitting.}
-  \item{min.dist}{
-the minimal distance for a location to be included. Must be larger than 0 for fitting purposes and might be 0 for prediction.
-}
-}
-\value{
-An object of \code{\linkS4class{neighbourhood}}.
-}
-\author{
-Benedikt Graeler
-}
-
-\seealso{
-See \code{\link{neighbourhood}} for the native constructor of a \code{\linkS4class{neighbourhood}} class.
-}
-\examples{
-library(sp)
-spdf <- data.frame(x=c(112,154,212,289,345),y=c(124,198,85,168,346),measure=rlnorm(5))
-coordinates(spdf) <- ~x+y
-
-getNeighbours.experimental(spdf,size=4)
-}
-\keyword{ spatial }
\ No newline at end of file



More information about the spcopula-commits mailing list