You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ggplot(Beazley, aes(x = DAT_mean, fill = Technique)) +
62
-
geom_histogram() + plot_theme + plot_fill
62
+
geom_histogram(binwidth = 25, position = "dodge") + plot_theme + plot_fill
63
63
```
64
64
65
65
Employing dating steps will even out unreasonable peaks. Not especially the gap between -425 and -300 in the plot above, that is -- in the plot below -- filled with a constant amount of objects in each year. This is due to the data containing large amounts of objects dating from -400 to -300 BCE. Of couse, due to duplicating each object numerous times (see table below), the counts represented on the y-axis have become meaningless.
@@ -68,15 +68,15 @@ Employing dating steps will even out unreasonable peaks. Not especially the gap
68
68
library(datplot)
69
69
result <- datsteps(Beazley, stepsize = 5)
70
70
ggplot(result, aes(x = DAT_step, fill = variable)) +
71
-
geom_histogram() + plot_theme + plot_fill
71
+
geom_histogram(binwidth = 25, position = "dodge") + plot_theme + plot_fill
72
72
```
73
73
74
74
`datsteps()` can also calculate a stepsize on its own. It equals the closest possible dating of any object.
75
75
76
76
```{r steps2}
77
77
result <- datsteps(Beazley, stepsize = "auto")
78
78
ggplot(result, aes(x = DAT_step, fill = variable)) +
79
-
geom_histogram() + plot_theme + plot_fill
79
+
geom_histogram(binwidth = 25, position = "dodge") + plot_theme + plot_fill
80
80
```
81
81
82
82
@@ -89,7 +89,7 @@ Due to the impossibility of displaying object counts as well, it is ideal to use
89
89
```{r density one}
90
90
result <- datsteps(Beazley, stepsize = 25)
91
91
dens <- result
92
-
dens$weight <- (dens$weight / sum(dens$weight))
92
+
dens <- scaleweight(result, var = "all")
93
93
dens <- density(x = dens$DAT_step, weights = dens$weight)
94
94
plot(dens)
95
95
```
@@ -102,7 +102,7 @@ In order to display the objects seperated into groups, the weights first have to
102
102
103
103
104
104
```{r scaleweight}
105
-
result <- scaleweight(result, 2)
105
+
result <- scaleweight(result, var = 2)
106
106
```
107
107
108
108
```{r scaleweighttable, echo = FALSE}
@@ -117,13 +117,14 @@ In the case of the beazley archives data [@BAPD] we can clearly see what we knew
117
117
118
118
```{r ggplot, warning=FALSE}
119
119
ggplot(data = result, aes(x = DAT_step,
120
-
fill = variable)) +
121
-
geom_density(aes(weight = weight), alpha = 0.5) +
120
+
fill = variable,
121
+
weight = weight)) +
122
+
geom_density(alpha = 0.5) +
122
123
xlab("Dating") + plot_theme + plot_fill
123
124
```
124
125
125
126
126
-
Please note that the plot does change when the weights are omitted (see plot below). When every step is valued equally, a lot of steps fall into the end of the 4th century (as mentioned above), since they were dated as e.g. "-400 to -300".
127
+
Please note that the plot does change when the weights are omitted (see plot below). When every step is valued equally, a lot of steps fall into the end of the 4th century (as mentioned above), since they were dated as e.g. "-400 to -300". The impact here is not very huge, as the dating ranges of the objects do not vary greatly. However, the differences can be very dramatic for more heterogenious data.
We also added a function that calculated the value needed to scale the density curve to the axis of a Histogram of the dating steps. Please note that the histogram will not show the actual objects counts, but the counts of the maximum possible objects dated to the corresponding year resp. bin. The value to scale the density curve for a combined plot with a histogram can be obtained via `get.histogramscale`:
labs(y = "maximum number of objects per year", x = "Dating")
149
+
```
150
+
151
+
The combination of density curve and histogram also shows the common problem of histograms. Their output depends significantly on where the first bin is placed and may show a skewed distribution especially for roughly dated objects.
135
152
136
-
The smooth curves of kernel density estimates are a more realistic approach to dating. The production of objects was as continuous as their use, so it seems only reasonable to display it in a continuous fashion.
153
+
The smooth curves of kernel density estimates are a more realistic approach to dating. The production of objects was as continuous as their use, so it seems only reasonable to display it in a more continuous fashion on a flexible timescale.
0 commit comments