Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dataobservatory-eu/openmusesampling
https://github.com/dataobservatory-eu/openmusesampling
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dataobservatory-eu/openmusesampling
- Owner: dataobservatory-eu
- License: gpl-3.0
- Created: 2024-05-24T10:04:33.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-06T14:59:20.000Z (17 days ago)
- Last Synced: 2024-12-06T15:47:17.140Z (16 days ago)
- Language: R
- Homepage: https://dataobservatory-eu.github.io/openmusesampling/
- Size: 256 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# openmusesampling
This package contains functions to sample ISRCs using a Metropolis-Hastings uniform random-walk algorithm. Run the code below to see how it works. We are using a data with 1204 observations as our "population" and estimating the mean of the popularity index with samples of size 100.
```{r}
example <- openmusesampling(x = "popularity", data= sample_data)
example
```The estimate mean should be close to the true mean in our data.
```{r}
mean(sample_data$popularity)
```Check the histogram
```{r}
hist(example$samples$sample_mean_popularity,
xlab = "Values",
main = "Histogram of 1000 RW sample means with N = 100",
cex.main = 1.5,
cex.lab = 1.3,
cex.axis = 1.3)
box()
points(x = mean(sample_data$popularity), y = 0, pch = 17, col = "red", cex = 2)
points(x = mean(example$samples$sample_mean_popularity), y = 0, pch = 2, col = "blue", cex = 2, lwd = 2)
legend("topright", c("True pop. mean", "Mean RW distr."), col = c("red", "blue"), lwd = 3,
bty = "n")
```