## 这个作业是用R语言查找地震目录数据并进行预测

**IRDR0010 – Risk analysis for Disaster Science**

**Information about the final exam (coursework) – 75% of the final grade.**

Submissions will be made via Moodle and will be checked using TurnItIn for plagiarism. It goes without saying that your work must be your own and that any evidence of copying, collusion, or similar effort to present the work of others as your own will be investigated under the University rules for plagiarism, which includes a maximum penalty of exclusion from your degree programme.

The coursework will be marked out of 100, with the marks available described in the following section.

- There is a maximum 3000 words limit.
- Up to 10% over the limit will result in no penalty, > 10% over the word limit will result in a 10% mark deduction (rounded down for fractional marks) for that question.

The coursework title is: Find earthquake catalogue data and make a forecast. You can use any region you would like and the forecast can be for anytime frame you would like. You could either do a retrospective forecast (i.e. Remove some data from your catalogue and forecast a time period you already know what happened). In this case compare the real observations with your forecast in your report.

Alternatively, you could forecast a period in the future.

The report should have the following sections and the associated marks for each section are shown in the brackets.

**Choice of appropriate region [5%]**

**Data preparation and selection [20%].** Data need to be in different formats in order to be used in ZMAP and in R.

Since I have given the following information to several students I also include information here:

- The data in ZMAT must be in the following order: Long, Lat, Year, Month, Day, Magnitude, Depth, Hour, Minute. The data must be in .dat format. The easiest way to do that is to save your data as .txt and choose the encoding as ASCII. Following this just rename your file to .dat. There are other ways to import your data on ZMAP too, please look at the ZMAP manual to familiarise yourselves with other methods.
- For ETAS you need your data to be in a single time unit, for example days. Your first earthquake will be time zero, the second will be the time in days following the first earthquake, the third the time in days following the first earthquake and so on.

A way to do this in R is the following:

Read your file in R (the first six columns should be in this format: Year, Month, Day, Hour, Minute, Second)

M<-read.csv(enter your info here….)

times <- list()

for (i in 1:dim(M)[1]) {

str <- sprintf(“%s-%s-%s %s:%s:%s”, M[i,1],M[i,2],M[i,3],M[i,4],M[i,5],M[i,6])

times[[i]] <- as.POSIXlt(str) }

times <- sapply(times, function(z) {difftime(z,times[[1]], units=’days’)})

This is not the only way to do this task, for other methods use google to find how to do it.

**Initial steps [20%]. **Include here your initial analysis with ZMAP and associated plots. Comment on your results. Discuss factors that may affect your data analysis.

**Running the ETAS model [25%]: **For this part you need to find the posterior samples using all the earthquakes above the magnitude of completeness. Each sample contains a set of the ETAS parameters. You only need one set of parameters for the simulations. However, as we discussed in the lectures certain sets of parameters lead to an infinite number of earthquakes in the simulations. If this is the case, try another set of parameters.

**Simulations [10%]:** Use the ETAS function to simulate data. For your simulations the magnitude choice is the one above which you want to simulate. So if you are interested in forecasting earthquakes above magnitude 7 in this step use magnitude 7 in the function. You could use this as a rough guideline to avoid infinite simulations: 1) beta> alpha

2) k*beta/(beta-alpha) < 1. Use your critical thinking to assess the number of earthquakes you get from the simulations. For example, you can also compare them with the actual observations if you are doing a retrospective forecast.

You need to do a number of simulations (200 for example or even 1000) and then take the average number of earthquakes above the magnitude you decided to forecast. This is your final forecast.

For example: Say I want to forecast earthquakes above magnitude 6 in a period of 5 years. The first simulation gave me 4 earthquakes, the second 2, the third 8 and so on. The average of 4,2, 8……of the n total simulations is my forecast.

**Results and Discussion [20%].** If you decide to do a retrospective forecast compare your results with the observations. Critically assess your results. In the discussion mention, results and limitations.

**I will answer clarification questions about the assessment in the first 48 hours and post the responses on Moodle for all to read.**

**I will not answer technical questions or look at your data. This document has sufficient details to complete the exercise. Use your knowledge, your judgement and the internet to find answers.**