Statistical analysis scripts
Please email me at email@example.com if any scripts do no work properly! R packages are often updated or sometimes get archived, and as a result scripts may need periodic updating
This page contains scripts I use for statistical (and visual) analysis of structural geology data. I have worked with field fabrics (foliation or foliation-lineation paires) and anisotropy of magnetic susceptibility ellipsoids
For published work, I include all the files necessary to reproduce my statistical analysis.
Note: The scripts on this page have been written for specific static versions of the geologyGeometry library, for which download links are given. If you would rather download the most recent version of geologyGeometry (which may not be backwards-compatible with all statistical analyses), visit Joshua Davis's website.
From The utility of statistical analysis in structural geology (Roberts et al., 2018)
This paper analyzes three datasets: two from the West Mountain area of the western Idaho shear zone, and one from the Orofino area of the western Idaho shear zone, locally the Ahsahka shear zone. The two datasets from West Mountain are a foliation dataset and a dataset of foliation-lineation pairs. The data from Orofino are foliation-lineation pairs.
- If you have not already downloaded R and RStudio and set it up for using geologyGeometry, then follow the instructions to do so at the bottom of this page.
- Dowload geologyGeometry June 2017 version. This linked version already contains the datasets and statistical analyses from Roberts et al. (2018).
- Drag the 20170620geologyGeometry folder to your desktop. Note for Windows users: When Windows unzips a .zip file, it creates a folder with the .zip name. Open this folder, and you will fine the 20170620geologyGeometry folder within. Drag 20170620geologyGeometry to the desktop.
- The two statistical analysis scripts are titled JSG_StatisticalAnalysis_Orofino.r, and JSG_statisticalAnalysis_WestMountain.r, both located in the geologyGeometry folder. Open them in RStudio.
- At the top of each one, change setwd('~Desktop/20170620geologyGeometry') to reflect the true path to your geologyGeometry folder. You should not need to change this if you are using a Mac. If you are using Windows, the proper path format is commented (anything that has a '#' in front of it is 'commented', meaning it won't run). Fill in your user name, uncomment the line, and run it.
- Run each file line by line using "Run" button at the top of the window. Enjoy!
- Strongly encouraged: In the 20170620geologyGeometry folder, you will find many tutorial subdirectories. Each of these subdirectories contain well-commented tutorial scripts by Joshua Davis that guide you through the basics of statistical analysis. If you are new to coding, I recommend starting with the tutorial files in tutorialsR, followed by tutorialsDirections and tutorialsOrientations.
R/RStudio Setup Instructions before using geologyGeometry:
Dowload R for your system.
- Choose a "mirror site" that hosts the software, prefereably near your geographical location, for speed.
- On the mirror site, click to download a "precompiled binary distribution" of R for your operating system.
- Once the download is complete, run the installer program and follow its instructions.
- Download and install RStudio, a nice user interface for using R.
- If you are installing on a Mac computer, download and install XQuartz. (You will need to log out and log back in after installing to activate it). XQuartz is a unix windowing system that geologyGeometry uses for interactive plots.
Now, launch RStudio. It will open large window consisting of several "panes". Probably the Console pane is in the lower left corner of the window. Copy and paste (or retype) the following three lines of code into the Console pane, and then press Return to execute them. This step only needs to be done the first time you use R/RStudio. It will permenantly install some R packages that geologyGeometry uses.
- install.packages(c("rgl", "fields", "MASS"))
- install.packages(c("ICSNP", "expm", "FRB"))
- install.packages(c("Directional", "pracma"))
These commands should cause a flurry of activity. If you are notified that a source version is newer than a binary version, and asked whether to download the source version (y/n), enter n. If you see warnings about how some package was built with an earlier version of R, then ignore them. To check that each package installed correctly, copy each of the following lines into the console.
You are now all set up to use the geologyGeometry tools.