Skip to content

Commit

Permalink
new big realease, still working on details before submiting to CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyGelb committed Oct 27, 2023
1 parent 631ca53 commit 9f29613
Show file tree
Hide file tree
Showing 153 changed files with 866 additions and 9,514 deletions.
17 changes: 0 additions & 17 deletions .Rbuildignore.bak

This file was deleted.

1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Suggests:
knitr,
rmarkdown
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
VignetteBuilder:
knitr
URL: https://jeremygelb.github.io/spNetwork/
Expand Down
64 changes: 0 additions & 64 deletions DESCRIPTION.bak

This file was deleted.

12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# spNetwork 0.4.4

This is an important release!

## New Features

* It is now possible to do bandwidth selection with adaptive bandwidths
* One can also set local bandwidths manually for bandwidth selection

## Changes in function
* for all the function where the parameters *bw_range* and *bw_step* were used, they were replaced by a single argument *bws*. It gives more flexibility to the user.

# spNetwork 0.4.3.7

This is only a maintenance release. A bug in CRAN caused by multiprocessing in example caused the rejection of hte package.
Expand Down
9 changes: 1 addition & 8 deletions R/adaptive_simultaneous_tnkde_bw.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ worker_adaptive_bw_tnkde <- function(lines,
setDT(quad_events2)[events_loc2, on = "goid", vertex_id := i.vertex_id]

## step3 starting the calculations !
print(graph)
neighbour_list <- adjacent_vertices(graph,nodes$id,mode="out")
neighbour_list <- lapply(neighbour_list,function(x){return (as.numeric(x))})
print("here is the neighbour list : ")
print(neighbour_list)

kernel_values <- adaptive_bw_tnkde_cpp2(method = method,
neighbour_list = neighbour_list,
Expand Down Expand Up @@ -164,7 +161,7 @@ adaptive_bw_tnkde <- function(grid, events_loc, events, lines,
n_quadra <- length(selections)

dfs <- lapply(1:n_quadra,function(i){
print(i)

sel <- selections[[i]]

# sel_events gives us the events inside the quadra considered
Expand Down Expand Up @@ -211,8 +208,6 @@ adaptive_bw_tnkde <- function(grid, events_loc, events, lines,
final_bws_net <- array(0,dim = dim(tot_arr))
final_bws_time <- array(0,dim = dim(tot_arr))

print("here are the estimated densities before calculating local bws")
print(tot_arr)
for(i in 1:length(bw_net)){
for(j in 1:length(bw_time)){
k <- tot_arr[i,j,]
Expand Down Expand Up @@ -367,8 +362,6 @@ adaptive_bw_tnkde.mc <- function(grid, events_loc, events, lines,
final_bws_net <- array(0,dim = dim(tot_arr))
final_bws_time <- array(0,dim = dim(tot_arr))

print("here are the estimated densities before calculating local bws")
print(tot_arr)
for(i in 1:length(bw_net)){
for(j in 1:length(bw_time)){
k <- tot_arr[i,j,]
Expand Down
12 changes: 6 additions & 6 deletions R/bandwidth_selection_cv_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@
#' the dataset (leave one out cross validation). We use here the shortcut formula as
#' described by the package spatstat \insertCite{spatstatpkg}{spNetwork}.
#'
#' LCV(h) = sum[i] log(lambda[-i](x[i]))
#' \eqn{LCV(h) = \sum_i \log\hat\lambda_{-i}(x_i)}
#'
#' Where the sum is taken for all events x[i] and where lambda[-i](x[i]) is the leave-one-out kernel
#' estimate at x[i] for a bandwidth h. A higher value indicates a better bandwidth.
#' Where the sum is taken for all events \eqn{x_i} and where \eqn{\hat\lambda_{-i}(x_i)} is the leave-one-out kernel
#' estimate at \eqn{x_i} for a bandwidth h. A higher value indicates a better bandwidth.
#'
#' @references{
#' \insertAllCited{}
Expand Down Expand Up @@ -299,7 +299,7 @@ bw_cv_likelihood_calc <- function(bws = NULL,

passed <- bw_checks(check,lines,samples,events,
kernel_name, method, bws_net = bws,
adaptive = adaptive, trim_net_bws = trim_bws,
adaptive = adaptive, trim_net_bws = trim_bws, arr_bws_net = mat_bws,
diggle_correction = diggle_correction, study_area = study_area)

if(zero_strat %in% c("min_double", "remove") == FALSE){
Expand Down Expand Up @@ -464,7 +464,7 @@ bw_cv_likelihood_calc <- function(bws = NULL,
#' select an appropriate bandwidth in a data-driven approach
#'
#' @details See the function bw_cv_likelihood_calc for more details. The calculation is split
#' according to the parameter grid_shape. If grid_shape = c(1,1), then parallel processing cannot be used.
#' according to the parameter grid_shape. If `grid_shape = c(1,1)`, then parallel processing cannot be used.
#'
#' @template bw_selection-args
#' @template diggle_corr-arg
Expand Down Expand Up @@ -522,7 +522,7 @@ bw_cv_likelihood_calc.mc <- function(bws, lines, events, w, kernel_name, method,

passed <- bw_checks(check,lines,samples,events,
kernel_name, method, bws_net = bws, bws_time = NULL,
adaptive = adaptive, trim_net_bws = trim_bws,
adaptive = adaptive, trim_net_bws = trim_bws, arr_bws_net = mat_bws,
diggle_correction = diggle_correction, study_area = study_area)

if(zero_strat %in% c("min_double", "remove") == FALSE){
Expand Down
Loading

0 comments on commit 9f29613

Please sign in to comment.