# Tutorials

## Spatial Statistics and R

This page houses tutorials that I have written for new students in our research group (Zimmerman Lab). They include a brief introduction to the programming language R, an introduction to basic point pattern spatial statistic, and example usage for the *spatstat* and *rapt* R packages.

The programming language R is an incredible tool for data analysis. It is the programming language of choice for many people in the statistics community. The Zimmerman group uses it for most of our data analysis, so we have developed the following tutorials to get people started and comfortable using the tools that exist in R, as well as the tools that we have personally developed in the `rapt`

package to make data analysis easier for our research. This tutorial will include very basic introductions and examples in how to use R to analyze spatial data, and will also include links to other resources that go further into detail on many of the topics.

The tutorial sections include:

- Introduction to R and spatstat
- Basic Spatial Statistics Definitions
- Instensity Estimation
- Correlation and Spacing Functions
- Hypothesis Testing
- Marked Point Patterns
- Spatial Models and Tests
- Atom Probe Tomography and Spatial Stats
`rapt`

Example K-function complete spatial randomness acceptance interval envelopes with the observed K-function of a clustered point pattern superimposed.

##### Introduction to R and spatstat

In this first section, we will look at the basics of R and how to get started with the language. The online book R for Data Science (R4DS) is a great external reference for learning all there is to know about R for data analysis. If you have time to work through it, we highly suggest it. I will reference this book regularly through these tutorials. We will also cover the basics of using the `spatstat`

R package.

Summary of section:

- Installing R and Downloading Packages
- Creating Scripts and Projects
- Coding Basics with R
- Vectors
- Matrices
- Lists
- Factors
- Loops
- Functions
- Apply

- Point Patterns and
`ppp`

,`pp3`

Objects- Helpful Functions for
`ppp`

and`pp3`

Objects - Coding Basics with
`spatstat`

- Helpful Functions for

##### Basic Spatial Statistics Definitions

As we get are now getting into more examples of coding workflow for these tutorials, I will be switching over to “R Markdown”. This is a really cool interface with R that allows you to generate reports with inline code, code output, plots, etc. very easily. You can read more about it here: https://rmarkdown.rstudio.com/lesson-1.html.

In this section, we will cover the definitions of

- Intensity
- Point Processes
- Complete Spatial Randomness
- Homogeneity
- Stationarity & Isotropy
- Marks

These are all important definitions for continuing to further analysis of point patterns.

More content coming soon…