Skip to contents

Calculate mean energy

Usage

calculate_energy(
  pattern,
  weights = c(1, 1),
  return_mean = FALSE,
  verbose = TRUE
)

Arguments

pattern

List with reconstructed patterns.

weights

Vector with weights used to calculate energy. The first number refers to Gest(r), the second number to pcf(r).

return_mean

Logical if the mean energy is returned.

verbose

Logical if progress report is printed.

Value

vector

Details

The function calculates the mean energy (or deviation) between the observed pattern and all reconstructed patterns (for more information see Tscheschel & Stoyan (2006) or Wiegand & Moloney (2014)). The pair correlation function and the nearest neighbour distance function are used to describe the patterns.

References

Kirkpatrick, S., Gelatt, C.D.Jr., Vecchi, M.P., 1983. Optimization by simulated annealing. Science 220, 671–680. <https://doi.org/10.1126/science.220.4598.671>

Tscheschel, A., Stoyan, D., 2006. Statistical reconstruction of random point patterns. Computational Statistics and Data Analysis 51, 859–871. <https://doi.org/10.1016/j.csda.2005.09.007>

Wiegand, T., Moloney, K.A., 2014. Handbook of spatial point-pattern analysis in ecology. Chapman and Hall/CRC Press, Boca Raton. ISBN 978-1-4200-8254-8

Examples

pattern_random <- fit_point_process(species_a, n_random = 19)
#> Unmarking provided input pattern.
#> 
> Progress: n_random: 1/19		
#> 
> Progress: n_random: 2/19		
#> 
> Progress: n_random: 3/19		
#> 
> Progress: n_random: 4/19		
#> 
> Progress: n_random: 5/19		
#> 
> Progress: n_random: 6/19		
#> 
> Progress: n_random: 7/19		
#> 
> Progress: n_random: 8/19		
#> 
> Progress: n_random: 9/19		
#> 
> Progress: n_random: 10/19		
#> 
> Progress: n_random: 11/19		
#> 
> Progress: n_random: 12/19		
#> 
> Progress: n_random: 13/19		
#> 
> Progress: n_random: 14/19		
#> 
> Progress: n_random: 15/19		
#> 
> Progress: n_random: 16/19		
#> 
> Progress: n_random: 17/19		
#> 
> Progress: n_random: 18/19		
#> 
> Progress: n_random: 19/19		
#> 

calculate_energy(pattern_random)
#> 
> Progress: 1/19		
#> 
> Progress: 2/19		
#> 
> Progress: 3/19		
#> 
> Progress: 4/19		
#> 
> Progress: 5/19		
#> 
> Progress: 6/19		
#> 
> Progress: 7/19		
#> 
> Progress: 8/19		
#> 
> Progress: 9/19		
#> 
> Progress: 10/19		
#> 
> Progress: 11/19		
#> 
> Progress: 12/19		
#> 
> Progress: 13/19		
#> 
> Progress: 14/19		
#> 
> Progress: 15/19		
#> 
> Progress: 16/19		
#> 
> Progress: 17/19		
#> 
> Progress: 18/19		
#> 
> Progress: 19/19		
#> 

#>  randomized_1  randomized_2  randomized_3  randomized_4  randomized_5 
#>    0.15889662    0.15793317    0.10702814    0.12476093    0.08082550 
#>  randomized_6  randomized_7  randomized_8  randomized_9 randomized_10 
#>    0.10203516    0.09421586    0.10541905    0.11258008    0.12814230 
#> randomized_11 randomized_12 randomized_13 randomized_14 randomized_15 
#>    0.12987428    0.16519418    0.12190628    0.14366453    0.14010312 
#> randomized_16 randomized_17 randomized_18 randomized_19 
#>    0.12379959    0.13504993    0.14831680    0.14833710 
calculate_energy(pattern_random, return_mean = TRUE)
#> 
> Progress: 1/19		
#> 
> Progress: 2/19		
#> 
> Progress: 3/19		
#> 
> Progress: 4/19		
#> 
> Progress: 5/19		
#> 
> Progress: 6/19		
#> 
> Progress: 7/19		
#> 
> Progress: 8/19		
#> 
> Progress: 9/19		
#> 
> Progress: 10/19		
#> 
> Progress: 11/19		
#> 
> Progress: 12/19		
#> 
> Progress: 13/19		
#> 
> Progress: 14/19		
#> 
> Progress: 15/19		
#> 
> Progress: 16/19		
#> 
> Progress: 17/19		
#> 
> Progress: 18/19		
#> 
> Progress: 19/19		
#> 

#> [1] 0.1277938

if (FALSE) {
marks_sub <- spatstat.geom::subset.ppp(species_a, select = dbh)
marks_recon <- reconstruct_pattern_marks(pattern_random$randomized[[1]], marks_sub,
n_random = 19, max_runs = 1000)
calculate_energy(marks_recon, return_mean = FALSE)
}