Documentos de Académico
Documentos de Profesional
Documentos de Cultura
n <- 200
xmin <- 0
xmax <- 1
ymin <- 0
ymax <- 2
ls.str()
plot(x, y, asp = a)
mapxy(1)
library(spatstat)
radius <- 10
# Take the square root of the values to get a uniform spatial distribution
plot(disc(radius)); points(x, y)
ls.str()
qt <- quadrat.test(ppxy)
plot(qt)
print(qt)
plot(ppois)
plot(p_cluster)
set.seed(123)
plot(p_regular)
p_poisson; p_regular
# Calc nearest-neighbor distances for Poisson point data
hist(nnd_poisson)
# Estimate G(r)
plot(G_poisson)
hist(nnd_regular)
plot(G_regular)
# Point patterns are pre-defined
plot(K_poisson, . ~ r)
plot(K_poisson, . - pi * r ^ 2 ~ r)
plot(K_cluster_env, . - pi * r ^ 2 ~ r)
plot(K_regular_env, . - pi * r ^ 2 ~ r)
# Load the spatstat package
library(spatstat)
summary(preston_crime)
table(marks(preston_crime))
preston_map <- function(cols = c("green", "red"), cex = c(1, 1), pch = c(1, 1)) {
plot(preston_crime, cols = cols, pch = pch, cex = cex, add = TRUE, show.window = TRUE)
preston_crime
plot(crime_splits)
plot(frac_violent_crime_density)
# Scan from 500m to 1000m in steps of 50m
preston_crime,
opt = 1)
head(bw_choice)}
print(bw_choice$hcv)
pts = preston_crime,
h = bw_choice$hcv,
opt = 3,
ntest = 10,
proc = FALSE)
str(seg)
y = seg$gridy,
ncol = ncol))
image(prob_violent)
y = seg$___,
ncol = ncol))
image(p_value)
y = seg$gridy,
ncol = ncol))
image(p_value)
# Get a quick summary of the dataset
summary(sasq)
plot(unmark(sasq))
names(marks(sasq))
plot(table(marks(sasq)$month))
plot(sasq_by_month)
plot(density(sasq_by_month))
# Use the cartogram and rgeos packages
library(cartogram)
library(rgeos)
plot(carto_ref)
spplot(carto_ref, "Pct_Remain")
# Use the spdep package
library(spdep)
moran.test(
london_ref$TOTAL_POP,
nb2listw(borough_nb)
# Map % Remain
moran.mc(
london_ref$Pct_Remain,
nb2listw(borough_nb),
999
)
# Get a summary of the data set
summary(london)
spplot(london, "Flu_OBS")
# Compute and print the overall incidence of flu
spplot(london, "Flu_SMR")
# For the binomial statistics function
library(epitools)
library(ggplot2)
geom_pointrange() +
observed = london$Flu_OBS,
population = london$TOTAL_POP,
expected = london$Flu_EXP,
e = 2)
pal <- c(
rep("#B0D0B0", 40),
colorRampPalette(c("#B0D0B0", "orange"))(5),
colorRampPalette(c("orange", "red"))(5)
Flu_OBS ~ HealthDeprivation,
offset = log(TOTAL_POP),
data = london,
family = poisson)
# Is HealthDeprivation significant?
summary(model_flu)
# Put residuals into the spatial data.
spplot(london, "Flu_Resid")
library(spdep)
# Use R2BayesX
library(R2BayesX)
# Fit a GLM
# Summarize it
summary(model_flu)
# Calculate coeff confidence intervals
confint(model_flu)
# Summarize it
summary(bayes_flu)
plot(samples(bayes_flu))
offset = log(london$TOTAL_POP),
summary(flu_spatial)
summary(flu_spatial)
str(ca_geo, 1)
names(ca_geo)
summary(ca_geo$pH)
hist(ca_geo$pH)
table(miss)
spplot(ca_geo[!miss, ], "pH")
# ca_geo has been pre-defined
str(ca_geo, 1)
coordnames(ca_geo)
summary(m_trend)