THIS README IS FOR THE GRID_MESH/GAUSSIAN/GAUSSIAN_ANALYSIS DIRECTORY.

THIS DIRECTORY CONTAINS THE R SCRIPTS THAT CAN PRODUCE PLOTS AND TABLE OUTPUTS FOR THE TWO SIMULATION STUDIES. THERE ARE R MARKDOWNS WHICH WILL RUN THESE R SCRIPTS TO PRODUCE THE REQUIRED OUPUTS. WE ALSO INCLUDE SOME R SCRIPTS WHICH WILL LOOK AT ANY RUNS WHICH PRODUCED ERRORS, IN PARTICULAR THE BEHAVIOUR OF THE FIXED MEAN OF THE LATENT GAUSSIAN FIELD.
ADDITIONALLY, WE HAVE THE SUB-DIRECTORY ReLabelledPlots WHICH WAS INCLUDED TO PRODUCE ANY ALTERRED PLOTS - WHERE THE ALTERATIONS WERE DUE TO CHANGING THE X OR Y AXIS LABELS, OR THE TITLES.

- GridMeshSGTradOutput_final.R + GridMeshSGTrad.Rmd: this R script contains the code that will take in the output from the traditional simluation study and output plots and tables with summaries of the outputs, including inla() run times, parameter recovery, credible interval coverage as well as any information on the WAIC/DIC (which were not used within the thesis for the decision making process however the code and its output are useful to keep) as well as any errors, FFT warnings, or warnings. The .Rmd file loads the output files and sets up the require variable values to run the R script functions. They also print the outputs from the R script, maybe some plots as well as tables.
NOTE: The .Rmd file will be tidied up and may not be re-run after, and so the .html (with respect to the text and the name of R file sourced) file may not always match, but is kept to illustrate the output produced.
	-- Outputs: GridMeshSGTrad.html which contains some printed tables and plots, the plots created and saved tend to contain be pre-fixed by "SGTrad*.pdf", except for the coverage of the quantiles, which is just labelled "SGCoverage.pdf".

- SBC_SG_Param_final.R + SBC_Param_SG.Rmd: this R script considers the results for the SBC simulations study related to the parameters of the models and produces summaries for these, such as plotting all of the histograms for the SBC ranks as well as the summary statistics detailed in Chapter 3. This will also produce outputs for the errors and warnings for the SBC simulation study. Additionally, the histograms are overlayed with the results of the GLMs for the rank frequencies and the histogram plots also include the estimates of these model parameters. As with the traditional simulation study, the .Rmd file sets up the variables and loads the necessary data, printing the summary ouputs, while all plots are also saved.
NOTE: The .Rmd file will be tidied up and may not be re-run and so the .html file may not always match, but is kept to illustrate the output produced.
	-- Outputs: SBC_Param_SG.html which contains some printed tables and plots, the plots created and saved tend to contain be pre-fixed by "SGSBC*.pdf", except for the summary statistics which are labelled as "sumdisttest_param.pdf" or "outsideboundstest_param.pdf" and the histograms divergences/non-divergences which are labelled as "sbcdivergences_param.pdf" and "sbcnondivergences_param.pdf", respectively.

- SBC_SG_Latent_final.R + SBC_Latent_SG.Rmd: this R script considers the results for the SBC simulations study related to the latent Gaussian field of the models and produce summaries, such as plotting the histograms for the SBC ranks, in particular, for each Mesh the "worst" divergent histograms are plotted rather than all of the locations as this wold be extremely unreasonable. The number of "worst" divergent histograms plotted for each mesh are decided by the user in the .Rmd file. Also, the summary statistics across all the grid centres as detailed in Chapter 3 are plotted. Additionally, the histograms are overlayed with the results of the GLMs for the rank frequencies and the histogram plots also include the estimates of these model parameters.
NOTE: as with the traditional simulation study, the .Rmd file sets up the variables and loads the necessary data, printing the summary ouputs, while all plots are also saved. The .Rmd file will be tidied up and may not be re-run and so the .html file may not always match, but is kept to illustrate the output produced.
	-- Outputs: SBC_Latent_SG.html which contains some printed plots, the plots created and saved for the summary statistics are labelled as "sumdisttest.pdf" or "outsideboundstest.pdf" and the histograms ``worst'' divergences are labelled as "sbcdivergencesMesh*.pdf" for each mesh resolution, *, in the example.

- TradTimeTable3sf_final.R: this R script produces the results tables for the traditional simulation study at 3 significant figures, rather than re-running all of the outputs through the R Markdown, where the are more significant figures present, which is also interesting to keep.

- ParametersforErrors_final.R, GridMeshSGErrorMeanFieldChecks_final.R: these two R scripts are meant to briefly investigate the parameters and behaviour of the fixed mean of the latent field that resulted in erroneous outputs.

ReLabelledPlots SUB-DIRECTORY:
THIS CONTAINS THE .R SCRIPTS AND .Rmd FILES TO RE-RUN THE MAIN ANALYSIS PLOTS, WITH THE ADDITIONAL "*_Relabel.*" ADDED IN THE TITLE TO DISTINGUISH. PLOT LABELS THAT REQUIRED CHANGING WERE THE Y-AXIS AND X-AXIS FOR THE SUMMARY STATISTICS PLOTS AND THE REMOVAL OF "Grid 1" IN ANY OF THE PLOTS, HISTOGRAMS INCLUDED AS THE GAUSSIAN EXAMPLE DOES NOT VARY GRID RESOLUTIONS. THEREFORE, ANY OTHER PLOTS THAT WOULD HAVE BEEN PRODUCED IN THE "*_final.*" FILES THAT WE ARE NOT INTERESTED IN CHANGING THE LABELS FOR, ARE COMMENTED OUT IN THE FILES BELOW SO THAT THEY ARE NOT UNNECESSARILY REPRODUCED AS THEY WILL BE UNUSED.

- GridMeshSGTradOutput_Relabel.R + GridMeshSGTrad_Relabel.Rmd: same as before, without the parameter recovery, credible interval coverage, error or DIC/WAIC plots output, only saving the re-plotted average time with (s) to denotes the time unit on the y-axis label. Plots will have the following suffix attached: "*_Relabel.pdf".

- SBC_SG_Param_Relabel.R + SBC_Param_SG_Relabel.Rmd: same as before with label changes for the summary statistics and title changes for the histograms (remove mention of Grid 1 as there is only the grid used for the data generation here), and commenting out any plots for errors and DIC/WAIC for the SBC simulations so that they are not reproduced unnecessarily. Plots will have the following suffix attached: "*_Relabel.pdf".

- SBC_SG_Latent_Relabel.R + SBC_Latent_SG_Relabel.Rmd: same as before, although as with the parameter SBC analysis we have changed the y-axis labels for the summary statistics and have also removed any mention of Grid 1 for the histogram titles. Plots will have the following suffix attached: "*_Relabel.pdf".