Sjoerd
Sjoerd

Reputation: 1

How to fit a Gaussian to a pair correlation function?

I am fairly new to R and try using the spatstat package to analyze single-molecule microscopy data.

To find the average/dominant size of the observed clusters of points I convert my data into a 'ppp' and run a pair correlation function (pcf.ppp). I understood that the dominant cluster size is the sigma of a Gaussian fit to this function.

However, I have no clue how to fit a Gaussian function and to extract the sigma. Any help is much appreciated!

This is my code so far:

MyPattern <- ppp(Loc[,1],Loc[,2],c(10000,25000),c(10000,25000))
plot(MyPattern)
Test <- pcf.ppp(MyPattern)
plot(Test)

Upvotes: 0

Views: 101

Answers (1)

Adrian Baddeley
Adrian Baddeley

Reputation: 1984

The function kppm in the spatstat package does this. Just type

kppm(MyPattern)

and read the cluster scale parameter sigma. (Formally this is known as the "Thomas model"). To automate this you could do

fit <- kppm(MyPattern)
parameters(fit)

For further information see Chapter 12 in the spatstat book

Upvotes: 1

Related Questions