-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathips.Rd
More file actions
67 lines (61 loc) · 2.57 KB
/
Copy pathips.Rd
File metadata and controls
67 lines (61 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ips.R
\docType{data}
\name{ips}
\alias{ips}
\title{ONS International Passenger Survey Long-Term International Migration 1975–2012}
\format{
A data frame with 38 observations on the following 7 variables:
\describe{
\item{year}{Numeric vector; year of observation.}
\item{imm}{Numeric vector; immigration flow counts.}
\item{imm.ci}{Numeric vector; confidence intervals for immigration.}
\item{emi}{Numeric vector; emigration flow counts.}
\item{emi.ci}{Numeric vector; confidence intervals for emigration.}
\item{net}{Numeric vector; net migration flow counts.}
\item{net.ci}{Numeric vector; confidence intervals for net migration.}
}
}
\source{
Annual statistics on flows of international migrants to and from the UK and England and Wales
by the Office of National Statistics. Retrieved from "1.02 IPS Margins of Error, 1975–2012" spreadsheet.
Original spreadsheet no longer available on the ONS website, but a copy exists at
\url{https://github.com/guyabel/fanplot/tree/master/data-raw/}
}
\usage{
data(ips)
}
\description{
Immigration, emigration and net migration flow counts (and their confidence intervals)
for the UK from the International Passenger Survey (IPS) conducted by the Office of
National Statistics. Data formatted from the 2012 release of the Long-Term International
Migration Statistics.
}
\details{
Data differ slightly from the final adjusted migration estimates published by the ONS,
which take account of certain types of migration that the IPS does not capture, such as
asylum seekers, people migrating for longer or shorter than they thought they would,
and migration over land to and from Northern Ireland.
}
\examples{
# Standard plot
net <- ts(ips$net, start = 1975)
plot(net, ylim = range(net - ips$net.ci, net + ips$net.ci))
lines(net + ips$net.ci, lty = 2, col = "red")
lines(net - ips$net.ci, lty = 2, col = "red")
# Simulate values
ips.sim <- matrix(NA, nrow = 10000, ncol = length(net))
for (i in 1:length(net)) {
ips.sim[, i] <- rnorm(10000, mean = ips$net[i], sd = ips$net.ci[i] / 1.96)
}
# Spaghetti plot
plot(net, ylim = range(net - ips$net.ci, net + ips$net.ci), type = "n")
fan(ips.sim, style = "spaghetti", start = tsp(net)[1], n.spag = 50)
# Box plot
plot(net, ylim = range(net - ips$net.ci, net + ips$net.ci), type = "n")
fan(ips.sim, style = "boxplot", start = tsp(net)[1], llab = TRUE, outline = FALSE)
# Box fan
plot(net, ylim = range(net - ips$net.ci, net + ips$net.ci), type = "n")
fan(ips.sim, style = "boxfan", type = "interval", start = tsp(net)[1])
}
\keyword{datasets}