Skip to content

Commit 11b3256

Browse files
committed
[skip-ci] Some minor cosmetic changes to vignettes
1 parent 05fbffc commit 11b3256

File tree

2 files changed

+20
-39
lines changed

2 files changed

+20
-39
lines changed

Diff for: vignettes/articles/reconstruct_multi_patterns.Rmd

+14-35
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ editor_options:
1616
If you want more information about multi-trait point pattern reconstruction, please refer to the [corresponding paper](https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.14206
1717
).
1818

19-
If you wish to include several marks simultaneously in a reconstruction, you can
20-
use the following code. The libraries used must first be loaded.
19+
If you wish to include several marks simultaneously in a reconstruction, you can use the following code. The libraries used must first be loaded.
2120

2221
```{r message = FALSE, warning = FALSE}
2322
library(shar)
2423
library(spatstat)
2524
```
2625

27-
The next step is to load the point pattern, here is an example of a random point
28-
pattern with several marks to show the structure of the data used.
26+
> Please note that the maximum number of iterations has been set to `max_steps = 10000` and `n_repetitions = 1`/`n_repetitions = 3` to keep computational time low for this example. For real-world applications, it is advisable to raise these values. Additionally, we set `verbose = FALSE` in the vignette to minimize printed output. We recommend using the default setting `verbose = TRUE` when executing the code to view progress reports.
27+
28+
The next step is to load the point pattern, here is an example of a random point pattern with several marks to show the structure of the data used.
2929

3030
```{r}
3131
xr <- 500
@@ -39,49 +39,28 @@ random <- data.frame(x = x, y = y, dbh = diameter, species = factor(species))
3939
marked_pattern <- as.ppp(random, W = owin(c(0, xr), c(0, yr)))
4040
```
4141

42-
The point pattern must contain the following data An x and y coordinate, a
43-
metric mark (in metres) and a nominal mark defined as a factor. The order must
44-
be respected. Now the reconstruction with several marks can be started with the
45-
following code. Note that the maximum number of iterations has been set to
46-
max_steps = 10000 to keep the computation time for this example to a minimum.
47-
For an application, this value should be increased according to the number of
48-
points in the pattern.
42+
The point pattern must contain the following data An x and y coordinate, a metric mark (in metres) and a nominal mark defined as a factor. The order must be respected. Now the reconstruction with several marks can be started with the following code. Note that the maximum number of iterations has been set to max_steps = 10000 to keep the computation time for this example to a minimum. For an application, this value should be increased according to the number of points in the pattern.
4943

5044
```{r}
51-
reconstruction <- reconstruct_pattern_multi(
52-
marked_pattern,
53-
n_repetitions = 1,
54-
max_steps = 10000)
45+
reconstruction <- reconstruct_pattern_multi(marked_pattern, n_repetitions = 1, max_steps = 10000,
46+
verbose = FALSE)
5547
```
5648

57-
As a result, you will receive a list containing a variety of information, for
58-
example, the reference pattern, the reconstructed pattern, the number of
59-
successful actions, the energy development and much more. If you wish to
60-
perform several reconstructions of the same reference pattern, you must
61-
increase n_repetitions to the desired number.
49+
As a result, you will receive a list containing a variety of information, for example, the reference pattern, the reconstructed pattern, the number of successful actions, the energy development and much more. If you wish to perform several reconstructions of the same reference pattern, you must increase n_repetitions to the desired number.
6250

6351
```{r}
64-
reconstruction_2 <- reconstruct_pattern_multi(
65-
marked_pattern,
66-
n_repetitions = 2,
67-
max_steps = 10000)
52+
reconstruction_2 <- reconstruct_pattern_multi(marked_pattern, n_repetitions = 3, max_steps = 10000,
53+
verbose = FALSE)
6854
```
6955

70-
To activate a visualisation of the reconstruction that shows the changes in the
71-
pattern at the relevant time, you must proceed as follows.
56+
To activate a visualisation of the reconstruction that shows the changes in the pattern at the relevant time, you must proceed as follows.
7257

7358
```{r}
74-
reconstruction_3 <- reconstruct_pattern_multi(
75-
marked_pattern,
76-
n_repetitions = 1,
77-
max_steps = 10000,
78-
plot = TRUE)
59+
reconstruction_3 <- reconstruct_pattern_multi(marked_pattern, n_repetitions = 1, max_steps = 10000, plot = TRUE,
60+
verbose = FALSE)
7961
```
8062

81-
Finally, you can use the following function to view different summary statistics
82-
of the reference pattern (black line) compared to the reconstructed pattern
83-
(grey line). For this, however, the listed libraries must be loaded
84-
additionally.
63+
Finally, you can use the following function to view different summary statistics of the reference pattern (black line) compared to the reconstructed pattern (grey line). For this, however, the listed libraries must be loaded additionally.
8564

8665
```{r}
8766
plot(reconstruction)

Diff for: vignettes/articles/reconstruct_several_patterns.Rmd

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ knitr::opts_chunk$set(
1818
)
1919
```
2020

21-
In case you want to reconstruct several patterns at once (e.g. for different points in time if repeated censuses are available), you can use the following code. Please be aware that the maximum number of iterations was set to `max_runs = 10` to keep the computational time low for this example. For an applied case, this value should be increased.
21+
In case you want to reconstruct several patterns at once (e.g. for different points in time if repeated censuses are available), you can use the following code.
22+
23+
> Please note that the maximum number of iterations has been set to `max_runs = 1000` and `n_random = 3` to keep computational time low for this example. For real-world applications, it is advisable to raise these values. Additionally, we set `verbose = FALSE` in the vignette to minimize printed output. We recommend using the default setting `verbose = TRUE` when executing the code to view progress reports.
2224
2325
```{r load-packages, message = FALSE, warning = FALSE}
2426
library(shar)
@@ -34,7 +36,7 @@ list_pattern <- list(species_a, species_b)
3436
3537
# reconstruct all patterns in list
3638
result <- lapply(list_pattern, function(x) reconstruct_pattern(pattern = x, n_random = 3,
37-
max_runs = 10, verbose = FALSE))
39+
max_runs = 1000, verbose = FALSE))
3840
3941
```
4042

@@ -53,7 +55,7 @@ Firstly, reconstruct only the spatial characteristics *n* times. The observed pa
5355
```{r reconstruct-pattern}
5456
# reconstruct spatial strucutre
5557
reconstructed_pattern <- reconstruct_pattern(species_a, n_random = 3,
56-
max_runs = 10, return_input = FALSE,
58+
max_runs = 1000, return_input = FALSE,
5759
verbose = FALSE)
5860
```
5961

@@ -67,7 +69,7 @@ species_a_marks <- subset(species_a, select = dbh)
6769
result_marks <- lapply(reconstructed_pattern$randomized,
6870
function(x) reconstruct_pattern_marks(pattern = x,
6971
marked_pattern = species_a_marks,
70-
max_runs = 10,
72+
max_runs = 1000,
7173
n_random = 3, verbose = FALSE))
7274
```
7375

0 commit comments

Comments
 (0)