THIS README IS FOR THE GRID_MESH/REGULAR_POLYGON_LGCP/REGPOLLGCP_CODE DIRECTORY.

THIS DIRECTORY CONTAINS THE DATA AND CODE FOR THE IMPLEMENTATION OF THE TRADITIONAL AND SBC SIMULATION STUDY FOR LGCP DATA. WITHIN BOTH R SCRIPTS IS THE CODE THAT WAS RUN TO PRODUCE THE COVARIATES AND MESHES AND GRIDS, WHICH ARE THEN COMMENTED OUT AFTER THESE WERE CREATED AND STORED TO SAVE THE WASTED TIME IN RE-CREATING THE MESH AT EACH STEP AND TO ENSURE CONSISTENCY. THERE IS AN ADDITIONAL SUB-DIRECTORY, REGPOLLGCP_CODE_TESTINGVALUES WHICH IS DISCUSSED BELOW.

- GridMeshOptimTrad_final.R: this file contains the code to simulate the covariates and meshes at different resolutions for the simulation study, which are commented out after their initial creation. This R script contains the code to run the traditional simulation study for the grid-mesh optimisation method.

- GridMeshOptim_final.R: this file contains the code to simulate the covariates and meshes at different resolutions for the simulation study, which are commented out after their initial creation. This R script contains the code to run the SBC simulation study for the grid-mesh optimisation method. There was a minor error in the code when it was run, for the mean field SBC rank calculations, this typo has since been fixed with a comment discussing the alteration.

- GridMeshOptim_TimeErrorRuns_final.R: this file contains the code (altered version of GridMeshOptim_final.R) to re-run the SBC simulation study for the simulation iteration and grid and mesh which resulted in a TIME ERROR (did not complete in 6 hours) and run with all cores of the node available (16). This file also takes in the backed-up generated data set for the simulation with the time error which is stored in the REGULAR_POLYGON_LGCP/REGPOLLGCP_OUTPUT/REGPOLLGCP_OUTPUT_ERROR directory with the suffix _TIMEERROR1.rda included. There was a minor error in the code when it was run, for the mean field SBC rank calculations, this typo has since been fixed with a comment discussing the alteration.

- MeshesRegPolLGCP.rda: this contains a list of meshes for each resolution.

- QuadratsRegPolLGCP.rda, CoordsRegPolLGCP.rda: pre-calculated grid discretisation of the regular window as well as the grid centres in order to save time when simulation data, especially as these are fixed for each data set. In the latter data set we also output the pre-calculated areas for each of the grid resolutions and indices to re-order to the coordinates, so that we traverse down the y axis before travelling across the x axis with respect to the grid cells.

- GridMeshRegPolLGCPSSCov.rda: the simulated covariates as rasters/pixel images where the latter is used for the data simulation using the spatstat R function rLGCP.

- CovAggGridRegPolLGCP.rda: covariates pre-aggregated over the different grid resolutions to prevent needing to re-calculate at each data simulation and saving time, especially for the finer grid resolutions.

- PlottingRegularPolygonData_final.R: This produces plots of the grids (Quadrat*RegPolLGCP*.pdf), meshes (Meshes*RegPolLGCP*.pdf) and covariates (CovariatesRegPolLGCP*.pdf), where additional plots targeted towards the simulations are produced by SimulateRegPlot_final.R which can be found in the REGPOLLGCP_CODE_TESTINGVALUES sub-directory.

THERE IS ALSO A SUB-DIRECTORY, REGPOLLGCP_CODE_TESTINGVALUES, CONTAINING THE CODE THAT WAS USED TO SIMULATE DATA AND ACCESS WHETHER THERE WERE REASONABLE DATA SETS BEING PRODUCED, RATHER THAN EXTREMELY LARGE DATA SETS OCCURRING OFTEN OR EVEN PRODUCING ERRORS WITHIN THE lgcp FUNCTION DUE TO VERY LARGE POINTS NEEDING TO BE SIMULATED.

THIS SUB-DIRECTORY ALSO CONTAINS THE DATA (COPIED OVER FROM THE MAIN DIRECTORY) FOR ANY SIMULATION NEEDS. ALTHOUGH, MOST WOULD BE UNUSED.
- *RegPolLGCP*.rda: the grids, meshes, covariates etc outputs are the same as those for the simulation studies, but are also kept in this folder for the purpose of these quick smulations.

- LGCPCovarianceandFixedPriorTestRegPol_final*.R: this contains some rough code for some quick tests of the behaviour of the point pattern data generation for different priors for sigma and the fixed effects, while the prior for rho is held fixed. With *=b this involves a slightly different prior for rho which can be found in the prior simulation function.

- RegPolCovFixedEffectsPriori*.rda: these are the outputs from different combinations of priors. The suffix i indexes the simulation hyperparameter values, which are also labelled in the R scripts and the inclusion of *=b refers to the results of the corresponding R script with the different rho prior. The additional suffix `_LongTest' in the output indicates that it was run with more simulations than the original runs.

- thetatilden_final.R: this produces some quick checks on the simulation of the point patterns for fixed values of the parameters, without any interest in the priors.

- SimulateRegPlot_final.R: this produces some plots of the simulated data sets from the fixed parameter values that will be used in the simulation studies. Output plots are saved as RegPolSimulatedDataSeti.pdf, where i=1,2 or 3.
