data(Test_Data_US)
# Create PSU ID with GeoDistPSU
g <- GeoDistPSU(Test_Data_US$lat,
Test_Data_US$long,
"miles",
100,
Input.ID = Test_Data_US$ID)
# Append PSU ID to input file
library(dplyr)
Test_Data_US <- dplyr::inner_join(Test_Data_US, g$PSU.ID, by=c("ID" = "Input.file.ID"))
# Split PSUs with MOS above 0.80
m <- GeoDistMOS(lat = Test_Data_US$lat,
long = Test_Data_US$long,
psuID = Test_Data_US$psuID,
n = 15,
MOS.var = Test_Data_US$Amount,
MOS.takeall = 0.80,
Input.ID = Test_Data_US$ID)
# Create histogram of Measure of Size Values
hist(m$PSU.Max.MOS.Info$psuID.prob,
breaks = seq(0, 1, 0.1),
main = "Histogram of PSU Inclusion Probabilities (Certainties = 1)",
xlab = "Inclusion Probability",
ylab = "Frequency")
Run the code above in your browser using DataLab