Description Usage Format Source Examples
Monthly counts of charges laid and convictions made in Local Courts and Higher Court in armed robbery in New South Wales from 1995–2007.
1 |
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.
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 68 69 70 71 72 73 74 75 76 | ### 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)
|
Call:
glm(formula = Y ~ Step.2001 + I(Feb + Mar + Apr + May + Jun +
Jul) + I(Aug + Sep + Oct + Nov + Dec), family = binomial(link = logit),
data = RobberyConvict, na.action = na.omit, x = TRUE)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.5435 -0.8978 0.1682 0.8011 2.6497
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.25685 0.15605 -1.646 0.09978 .
Step.2001 0.82315 0.08135 10.119 < 2e-16 ***
I(Feb + Mar + Apr + May + Jun + Jul) -0.37228 0.16188 -2.300 0.02146 *
I(Aug + Sep + Oct + Nov + Dec) -0.50068 0.16549 -3.025 0.00248 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 327.48 on 149 degrees of freedom
Residual deviance: 212.12 on 146 degrees of freedom
AIC: 684.79
Number of Fisher Scoring iterations: 4
Call: glarma(y = Y, X = X, type = "Bin", method = "NR", residuals = "Pearson",
phiLags = c(1), maxit = 100, grad = 1e-06)
GLARMA Coefficients:
phi_1
0.08175172
Linear Model Coefficients:
(Intercept) Step.2001
-0.2746835 0.8220330
I(Feb + Mar + Apr + May + Jun + Jul) I(Aug + Sep + Oct + Nov + Dec)
-0.3567715 -0.5003871
Degrees of Freedom: 149 Total (i.e. Null); 145 Residual
Null Deviance: 327.4831
Residual Deviance: 198.9089
AIC: 680.676
Call: glarma(y = Y, X = X, type = "Bin", method = "NR", residuals = "Pearson",
phiLags = c(1), maxit = 100, grad = 1e-06)
Pearson Residuals:
Min 1Q Median 3Q Max
-2.4456 -0.8159 0.1337 0.7301 2.4798
GLARMA Coefficients:
Estimate Std.Error z-ratio Pr(>|z|)
phi_1 0.08175 0.03298 2.479 0.0132 *
Linear Model Coefficients:
Estimate Std.Error z-ratio Pr(>|z|)
(Intercept) -0.27468 0.15711 -1.748 0.08041 .
Step.2001 0.82203 0.09571 8.589 < 2e-16 ***
I(Feb + Mar + Apr + May + Jun + Jul) -0.35677 0.15981 -2.232 0.02559 *
I(Aug + Sep + Oct + Nov + Dec) -0.50039 0.16333 -3.064 0.00219 **
Null deviance: 327.48 on 149 degrees of freedom
Residual deviance: 198.91 on 145 degrees of freedom
AIC: 680.676
Number of Newton Raphson iterations: 4
LRT and Wald Test:
Alternative hypothesis: model is a GLARMA process
Null hypothesis: model is a GLM with the same regression structure
Statistic p-value
LR Test 6.110 0.0134 *
Wald Test 6.144 0.0132 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Statistic p-value
LR Test 6.1104 0.01344 *
Wald Test 6.1443 0.01318 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Call:
glm(formula = Y ~ Trend + Trend.2001 + I(Feb + Mar + Apr + May +
Jun) + Dec, family = binomial(link = logit), data = RobberyConvict,
na.action = na.omit, x = TRUE)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.5072 -0.9098 0.1133 0.7891 3.6679
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.04210 0.05394 -0.781 0.435016
Trend 0.17272 0.01214 14.224 < 2e-16 ***
Trend.2001 -0.17600 0.02145 -8.206 2.29e-16 ***
I(Feb + Mar + Apr + May + Jun) 0.14669 0.03950 3.713 0.000204 ***
Dec 0.38137 0.07292 5.230 1.69e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 584.85 on 149 degrees of freedom
Residual deviance: 247.87 on 145 degrees of freedom
AIC: 956.57
Number of Fisher Scoring iterations: 4
Call: glarma(y = Y, X = X, type = "Bin", method = "NR", residuals = "Pearson",
phiLags = c(1, 2, 3), maxit = 100, grad = 1e-06)
GLARMA Coefficients:
phi_1 phi_2 phi_3
0.01229693 0.04177964 0.02805464
Linear Model Coefficients:
(Intercept) Trend
-0.0351250 0.1707481
Trend.2001 I(Feb + Mar + Apr + May + Jun)
-0.1721641 0.1549353
Dec
0.3914685
Degrees of Freedom: 149 Total (i.e. Null); 142 Residual
Null Deviance: 584.8472
Residual Deviance: 231.9971
AIC: 948.9794
Call: glarma(y = Y, X = X, type = "Bin", method = "NR", residuals = "Pearson",
phiLags = c(1, 2, 3), maxit = 100, grad = 1e-06)
Pearson Residuals:
Min 1Q Median 3Q Max
-3.0349 -0.9824 0.1392 0.7787 3.4460
GLARMA Coefficients:
Estimate Std.Error z-ratio Pr(>|z|)
phi_1 0.01230 0.01523 0.807 0.41956
phi_2 0.04178 0.01494 2.796 0.00517 **
phi_3 0.02805 0.01403 2.000 0.04553 *
Linear Model Coefficients:
Estimate Std.Error z-ratio Pr(>|z|)
(Intercept) -0.03512 0.07270 -0.483 0.629008
Trend 0.17075 0.01668 10.236 < 2e-16 ***
Trend.2001 -0.17216 0.02911 -5.915 3.32e-09 ***
I(Feb + Mar + Apr + May + Jun) 0.15494 0.04462 3.472 0.000516 ***
Dec 0.39147 0.07074 5.534 3.12e-08 ***
Null deviance: 584.85 on 149 degrees of freedom
Residual deviance: 232.00 on 142 degrees of freedom
AIC: 948.9794
Number of Newton Raphson iterations: 6
LRT and Wald Test:
Alternative hypothesis: model is a GLARMA process
Null hypothesis: model is a GLM with the same regression structure
Statistic p-value
LR Test 13.59 0.00352 **
Wald Test 11.97 0.00749 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Statistic p-value
LR Test 13.591 0.003518 **
Wald Test 11.968 0.007495 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.