grantbrown / ABSEIR

A Flexible and Computationally Efficient SEIRS Modeling Framework
6 stars 3 forks source link

DistanceModel and SEIRV model in ABSEIR #1

Closed Spatial-R closed 8 years ago

Spatial-R commented 8 years ago

Thanks for your ABSEIR package. To run theSPatialSEIRModel, we firstly need set the DistanceModel object. Fox example, the distance was created by the followed codes: DM1 = matrix(c(0,1,0,1,0,0,0,0,0), nrow = 3, byrow = TRUE) DM2 = matrix(c(0,0,1,0,0,0,1,0,0), nrow = 3, byrow = TRUE) DM3 = matrix(c(0,0,0,0,0,1,0,1,0), nrow = 3, byrow = TRUE) distance_model = DistanceModel(list(DM1, DM2, DM3), priorAlpha = 1, priorBeta = 25)

If the DM1 represents the adjacent relationship between the city A and other two cities(B and C), why should we also need the DM2 and DM3? In my opinion, if we know the relationship between city A and city B, then we also get the relationship between city B and city A. Moreover, if the number of city is large, it will be not wisely to build the DistanceModel on each DM. As far as i know, there are some packages (such as spdep and surveillance package) which is so convenient to build the spatial weight matrix only if we have the shp file.

Another question is that whether the method is suitable for the vaccine-preventable disease? As the vaccine immunization level in each city is different, is there any way to change the format of the model and then take the vaccine level into consideration (eg. build the SEIRV model)

grantbrown commented 8 years ago

Those are good questions, and touch on an area where the documentation could be better.

As for your first question, understanding the distance matrix structure is important for fitting interesting models in ABSEIR. Each matrix has a separate spatial auto-correlation parameter, so the amount of flexibility you want to include in the spatial model will determine how many matrices you will include. The specification included in the West Africa example uses three distance matrices because it allows a different contact parameter for each national border.

For example, the first distance matrix only captures contact between Guinea and Liberia. If you look at DM1, it should look like:

0,1,0, 
1,0,0,
0,0,0

This gets multiplied by a spatial autocorrelation parameter; let's call it p1:

0,p1,0,
p1,0,0,
0,0,0

The rows correspond to spatial locations: Guinea, Liberia, and Sierra Leone. The columns are the same locations, capturing epidemic contact from each location to the corresponding row. With that in mind, this first distance matrix only describes contact (in a symmetric way) between the first two locations: Guinea and Liberia. Adding in the other two distance matrices and their spatial auto-correlation parameters, the final specification is:

0,p1,p2,
p1,0,p3,
p2,p3,0

If you want to assume that all of the national borders have the same contact rates, you could do something like the traditional CAR model:

DM1 = matrix(c(0,1,1,1,0,1,1,1,0), nrow = 3, byrow = TRUE)

This would produce a matrix with 1's on the off-diagonal:

0,1,1,
1,0,1,
1,1,0

The corresponding parameterized version would be:

0,p1,p1,
p1,0,p1,
p1,p1,0

In my opinion, if we know the relationship between city 1 and city 2, then we also get the relationship between city 2 and city 1.

That's often the case, but not necessarily true. Consider an example where one population center is downstream from another, and you're interested in water-borne illnesses. In this case, the contact process would be asymmetric. The distance matrix structure is designed to be flexible enough to handle cases like this.

Moreover, if the number of city is large, it will be not wisely to build the DistanceModel on each DM. As far as i know, there are some packages (such as spdep and surveillance package) which is so convenient to build the spatial weight matrix only if we have the shp file.

I'd be interested in seeing an example of this for areal data; it sounds like something which would be useful to incorporate into a vignette. In general, I've just used R to programmatically generate complex distance structures. If you have a data set of locations with, for example, administrative unit centroid latitude and longitude, it is relatively straightforward to automatically generate a distance matrix just using basic R code. Another way I've often addressed this problem is to obtain or build a list of administrative borders. This can be used to generate a CAR style distance matrix, with 1's in the positions where a border is present.

If you have a specific example I may be able to help you build such a matrix, and add the process to the documentation.

Another question is that whether the method is suitable for the vaccine-preventable disease? As the vaccine immunization level in each city is different, is there any way to change the format of the model and then take the vaccine level into consideration (eg. build the SEIRV model)

This is a very good question. Currently, this kind of data must be incorporated directly into the exposure process design matrix; ABSEIR only fits spatial SEIR models. I am currently working on more general compartmental modeling software, but in the meantime this kind of data needs to be encoded into the transitions, rather than introducing additional compartments (i.e., V).

The design matrix for the S to E transition is a currently a little peculiar, but I've had trouble coming up with a better design. Basically, for every spatial location, you have a design matrix with T rows (number of time points) and p columns (number of covariate). Clearly, these covariates can either be time varying, or just vary between spatial units.

Consider the following example:

In this case, we could specify the design matrix as follows:

intercepts <- diag(5)[rep(1:5, each = 100),]
temporalTerm <- rep(1:100/100, 5)
designMatrix <- cbind(intercepts, temporalTerm)

Note: The order in which the spatial location information is included must be the same as the ordering of the rows/columns of the distance matrices.

Information on public health interventions, including vaccination campaigns or rates, can be incorporated as temporally or spatially varying covariates. You can also choose appropriate prior means and precisions for the corresponding parameters.

Let me know if that doesn't clear things up. If you have an example data set I'd be happy to help you work through the ABSEIR specification

Spatial-R commented 8 years ago

Thanks. Here we will use the dataset named measles.weser in the surveillance package, which represents the measles in the Weser-Ems region of Lower Saxony, Germany, 2001-2002. The code is as followed: require(surveillance) data(measles.weser);data(MMRcoverageDE) cases<-measles.weser$observed; neighbourhood<-measles.weser$neighbourhood; pop<-measles.weser$populationFrac*1000000 #### just assumption week<-measles.weser$week vaccine.cov<-MMRcoverageDE[1:15,4] ### just assumption

Now, i will build the model to meet the followed demand:

Thanks again!

grantbrown commented 8 years ago

Hi, just want to let you know that I have an example analysis of that data just about ready; I'll do my best to get it posted tomorrow.

grantbrown commented 8 years ago

Here's a quick take on the analysis you mentioned. At a glance, I'd say that the model isn't capturing a good chunk of the variability observed for this measles outbreak.

I'm working on a new sampler which should speed up problems like these as well, so stay tuned for that work in the next few weeks.