R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Directory data to keep out ##

plotmap(casespopulation$smr01,LGA,nclr=9)
title("raw standardised morbidity ratio-TIA")

## [1] "SpatialPolygonsDataFrame"
## attr(,"package")
## [1] "sp"
## [1] "SpatialPolygons"
## attr(,"package")
## [1] "sp"
plotmap(results$RR,LGAsp,nclr=9,location="topleft")
title("Empirical Bayes Risk-Hypertension")

## Warning: package 'spdep' was built under R version 3.3.3
## Loading required package: Matrix

plot(LGAxy2,border="red")
#plot(xx,coordinates(LGA),add=TRUE)
plot(xx2,coordinates(LGAxy2), add=TRUE,pch=".",lwd=2)
title(main="subset of LGA and neighbours")

## Neighbour list object:
## Number of regions: 77 
## Number of nonzero links: 312 
## Percentage nonzero weights: 5.26227 
## Average number of links: 4.051948 
## 4 regions with no links:
## 32 33 71 72
## 
##  0  1  2  3  4  5  6  7  8  9 
##  4  4  8 17 10 14 13  4  2  1
plotmap(localEB$est,LGAxy2,nclr=9)
title(main="Local moment estimator of TIA")

## The default for subtract_mean_in_numerator set TRUE from February 2016
## 
##  Monte-Carlo simulation of Empirical Bayes Index (mean subtracted)
## 
## data:  cases: casespopulation$freq01, risk population: casespopulation$X2001
## weights: nb2listw(xx2, style = "B", zero.policy = TRUE)
## number of simulations + 1: 1000
## 
## statistic = 0.1301, observed rank = 963, p-value = 0.037
## alternative hypothesis: greater
## 
##  Monte-Carlo simulation of Moran I
## 
## data:  EBI.p 
## weights: nb2listw(xx2, style = "B", zero.policy = TRUE)  
## number of simulations + 1: 1000 
## 
## statistic = 0.13596, observed rank = 964, p-value = 0.036
## alternative hypothesis: greater
plotmap(EBI.p,LGAxy2,nclr=9)
title(main="Permutation test for Empirical Bayes")

## This is INLA 0.0-1485844051, dated 2017-01-31 (09:14:12+0300).
## See www.r-inla.org/contact-us for how to get help.
## 
## Call:
## lm(formula = casespopulation$smr01 ~ casespopulation$age0175 + 
##     casespopulation$HTN01 + fitted(LGAFilt), data = casespopulation)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.6958 -0.4868 -0.0215  0.3185  3.6587 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)   
## (Intercept)               0.8731     0.4086   2.136  0.03619 * 
## casespopulation$age0175   1.0346     0.7133   1.451  0.15145   
## casespopulation$HTN01    -0.6873     0.8061  -0.853  0.39678   
## fitted(LGAFilt)vec3      -2.3033     0.8795  -2.619  0.01084 * 
## fitted(LGAFilt)vec2      -2.0030     0.8795  -2.277  0.02586 * 
## fitted(LGAFilt)vec14      2.4382     0.8795   2.772  0.00715 **
## fitted(LGAFilt)vec9      -1.2624     0.8795  -1.435  0.15571   
## fitted(LGAFilt)vec4      -0.9890     0.8795  -1.125  0.26467   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8795 on 69 degrees of freedom
## Multiple R-squared:  0.2684, Adjusted R-squared:  0.1942 
## F-statistic: 3.616 on 7 and 69 DF,  p-value: 0.002242

Including Plots

#plot(TIA)
plotmap(LGAlm$fitted.values,LGAxy2,nclr=9)
title(main="Spatial regression: TIA with covariates HT and Age")

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.