RobberyConvict | R Documentation |
Monthly counts of charges laid and convictions made in Local Courts and Higher Court in armed robbery in New South Wales from 1995–2007.
data(RobberyConvict)
A data frame containing the following columns:
[, 1] | Date | Date in month/year format. |
[, 2] | Incpt | A vector of ones, providing the intercept in the model. |
[, 3] | Trend | Scaled time trend. |
[, 4] | Step.2001 | Unit step change from 2001 onwards. |
[, 5] | Trend.2001 | Change in trend term from 2001 onwards. |
[, 6] | HC.N | Monthly number of cases for robbery (Higher Court). |
[, 7] | HC.Y | Monthly number of convictions for robbery (Higher court). |
[, 8] | HC.P | Proportion of convictions to charges for robbery (Higher court). |
[, 9] | LC.N | Monthly number of cases for robbery (Lower court). |
[, 10] | LC.Y | Monthly number of convictions for robbery (Lower court). |
[, 11] | LC.P | Proportion of convictions to charges for robbery (Lower court). |
Dunsmuir, William TM, Tran, Cuong, and Weatherburn, Don (2008) Assessing the Impact of Mandatory DNA Testing of Prison Inmates in NSW on Clearance, Charge and Conviction Rates for Selected Crime Categories.
### Example with Robbery Convictions
data(RobberyConvict)
datalen <- dim(RobberyConvict)[1]
monthmat <- matrix(0, nrow = datalen, ncol = 12)
dimnames(monthmat) <- list(NULL, c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))
months <- unique(months(strptime(RobberyConvict$Date, format = "%m/%d/%Y"),
abbreviate=TRUE))
for (j in 1:12) {
monthmat[months(strptime(RobberyConvict$Date, "%m/%d/%Y"),
abbreviate = TRUE) == months[j], j] <- 1
}
RobberyConvict <- cbind(rep(1, datalen), RobberyConvict, monthmat)
rm(monthmat)
## LOWER COURT ROBBERY
y1 <- RobberyConvict$LC.Y
n1 <- RobberyConvict$LC.N
Y <- cbind(y1, n1-y1)
glm.LCRobbery <- glm(Y ~ Step.2001 +
I(Feb + Mar + Apr + May + Jun + Jul) +
I(Aug + Sep + Oct + Nov + Dec),
data = RobberyConvict, family = binomial(link = logit),
na.action = na.omit, x = TRUE)
summary(glm.LCRobbery, corr = FALSE)
X <- glm.LCRobbery$x
## Newton Raphson
glarmamod <- glarma(Y, X, phiLags = c(1), type = "Bin", method = "NR",
residuals = "Pearson", maxit = 100, grad = 1e-6)
glarmamod
summary(glarmamod)
## LRT, Wald tests.
likTests(glarmamod)
## Residuals and Fit Plots
plot.glarma(glarmamod)
## HIGHER COURT ROBBERY
y1 <- RobberyConvict$HC.Y
n1 <- RobberyConvict$HC.N
Y <- cbind(y1, n1-y1)
glm.HCRobbery <- glm(Y ~ Trend + Trend.2001 +
I(Feb + Mar + Apr + May + Jun) + Dec,
data = RobberyConvict, family = binomial(link = logit),
na.action = na.omit, x = TRUE)
summary(glm.HCRobbery,corr = FALSE)
X <- glm.HCRobbery$x
## Newton Raphson
glarmamod <- glarma(Y, X, phiLags = c(1, 2, 3), type = "Bin", method = "NR",
residuals = "Pearson", maxit = 100, grad = 1e-6)
glarmamod
summary(glarmamod)
## LRT, Wald tests.
likTests(glarmamod)
## Residuals and Fit Plots
plot.glarma(glarmamod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.