Learn R Programming

SphericalK (version 1.2)

sphere_random: Generate Random Points On Sphere

Description

Generate random points on the sphere.

Usage

sphere_random(n)

Arguments

n
Nnumber of data points on the sphere

Value

latitudes Latitudes of n random points on the spherelongitudes Longitudes of n random points on the sphere

See Also

sphere_khat,sphere_montekhat

Examples

Run this code
#Spherical K function (minus CSR) with 99% confidence intervals
#for point patterns associated with 80 random points

sphererandom<-sphere_random(80)
latrd<-sphererandom$latitudes;lonrd<-sphererandom$longitudes
d<-seq(from=0,to=pi,by=0.15)
nd<-length(d)
d[nd]<-pi
khatrd<-sphere_khat(latrd,lonrd,d)
Kcird<-sphere_montekhat(80,75,d)
plot(d,khatrd,type='n', ylim=c(-0.4,0.5),xlim=c(0,pi),xaxt = "n",
     ylab = expression(K - CSR),xlab = expression("Spherical Angle"))
axis(1, at = c(0,pi/6, pi/3, pi/2, 2*pi/3, 5*pi/6, pi),
     labels = expression(0,pi/6, pi/3, pi/2, 2*pi/3, 5*pi/6, pi))
polygon(c(d, rev(d)), c(Kcird[1,], rev(Kcird[74,])),col = "grey79", border = FALSE)
lines(d,khatrd,col = 4, lwd=2)
lines(y=c(0,0),x=c(0,pi),type='l',lty=2,lwd=2)

Run the code above in your browser using DataLab