Data “Lansing” berisi lokasi dan klasifikasi dari pohon-pohon yang berada di Lansing Woods, Clinton County, Michigan, AS. Data ini diambil dari plot berukuran 924 kaki x 924 kaki (sekitar 19,6 acre) oleh D.J. Gerrard. Data tersebut mencakup 2251 pohon yang diklasifikasikan ke dalam beberapa kelompok botani, termasuk hickories, maples, red oaks, white oaks, black oaks, dan pohon-pohon lain yang tergolong “miscellaneous.”
library(spatstat)
## Warning: package 'spatstat' was built under R version 4.3.3
## Loading required package: spatstat.data
## Warning: package 'spatstat.data' was built under R version 4.3.3
## Loading required package: spatstat.univar
## Warning: package 'spatstat.univar' was built under R version 4.3.3
## spatstat.univar 3.0-0
## Loading required package: spatstat.geom
## Warning: package 'spatstat.geom' was built under R version 4.3.3
## spatstat.geom 3.3-2
## Loading required package: spatstat.random
## Warning: package 'spatstat.random' was built under R version 4.3.3
## spatstat.random 3.3-1
## Loading required package: spatstat.explore
## Warning: package 'spatstat.explore' was built under R version 4.3.3
## Loading required package: nlme
## spatstat.explore 3.3-1
## Loading required package: spatstat.model
## Warning: package 'spatstat.model' was built under R version 4.3.3
## Loading required package: rpart
## spatstat.model 3.3-1
## Loading required package: spatstat.linnet
## Warning: package 'spatstat.linnet' was built under R version 4.3.3
## spatstat.linnet 3.2-1
##
## spatstat 3.1-1
## For an introduction to spatstat, type 'beginner'
data(lansing)
dt <- lansing
plot(dt, main = "lansing")
axis(1)
axis(2)
summary(dt)
## Marked planar point pattern: 2251 points
## Average intensity 2251 points per square unit (one unit = 924 feet)
##
## *Pattern contains duplicated points*
##
## Coordinates are given to 3 decimal places
## i.e. rounded to the nearest multiple of 0.001 units (one unit = 924 feet)
##
## Multitype:
## frequency proportion intensity
## blackoak 135 0.05997335 135
## hickory 703 0.31230560 703
## maple 514 0.22834300 514
## misc 105 0.04664594 105
## redoak 346 0.15370950 346
## whiteoak 448 0.19902270 448
##
## Window: rectangle = [0, 1] x [0, 1] units
## Window area = 1 square unit
## Unit of length: 924 feet
dt <- split(lansing)
dt
## Point pattern split by factor
##
## blackoak:
## Planar point pattern: 135 points
## window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
##
## hickory:
## Planar point pattern: 703 points
## window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
##
## maple:
## Planar point pattern: 514 points
## window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
##
## misc:
## Planar point pattern: 105 points
## window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
##
## redoak:
## Planar point pattern: 346 points
## window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
##
## whiteoak:
## Planar point pattern: 448 points
## window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
dt_hickory <- dt$hickory
plot(dt$hickory, main="Pohon Hickory")
den <- density(x = dt_hickory, sigma = 0.1)
summary(den)
## real-valued pixel image
## 128 x 128 pixel array (ny, nx)
## enclosing rectangle: [0, 1] x [0, 1] units (one unit = 924 feet)
## dimensions of each pixel: 0.00781 x 0.0078125 units
## (one unit = 924 feet)
## Image is defined on the full rectangular grid
## Frame area = 1 square units
## Pixel values
## range = [220.5795, 1742.342]
## integral = 697.9707
## mean = 697.9707
plot(den, main = "Intensity Pohon Hickory, Sigma= 0,1")
contour(den, add = TRUE)
q <- quadratcount(dt_hickory, nx = 5, ny = 3)
plot(dt_hickory)
axis(1)
axis(2)
plot(q, add = TRUE, cex = 1.5)
mu <- mean(q)
sigma <- sd(q)^2
VMR <- sigma/mu
VMR
## [1] 14.60943
Didapati nilai VMR sebesar 14.6 > 1 yang termasuk kedalam kategori pola titik menyebar lebih mengelompok (kluster).
H0: Titik menyebar acak
H1: Titik tidak menyebar acak (uniform atau kluster)
quadrat.test(q)
##
## Chi-squared test of CSR using quadrat counts
##
## data:
## X2 = 204.53, df = 14, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 by 3 grid of tiles
p-value yang diperoleh lebih kecil dari tingkat signifikansi 0,05. Maka tolak h0 artinya terdapat bukti yang cukup untuk mengatakan bahwa titik tidak menyebar secara acak.
H0: Titik menyebar acak atau cluster
H1: Titik menyebar uniform
quadrat.test(q, alt = "regular")
##
## Chi-squared test of CSR using quadrat counts
##
## data:
## X2 = 204.53, df = 14, p-value = 1
## alternative hypothesis: regular
##
## Quadrats: 5 by 3 grid of tiles
p-value yang diperoleh lebih kecil dari tingkat signifikansi 0,05. Maka gagal tolak h0 artinya belum cukup bukti untuk mengatakan bahwa titik menyebar secara reguler/uniform
H0: Titik menyebar acak atau uniform
H1: Titik menyebar cluster
quadrat.test(q, alt = "clustered")
##
## Chi-squared test of CSR using quadrat counts
##
## data:
## X2 = 204.53, df = 14, p-value < 2.2e-16
## alternative hypothesis: clustered
##
## Quadrats: 5 by 3 grid of tiles
p-value yang diperoleh lebih kecil dari tingkat signifikansi 0,05. Maka tolak h0 artinya terdapat bukti yang cukup untuk mengatakan bahwa titik menyebar secara cluster.
nn <- nndist(lansing)
hist(nn)
K<- Kest(dt_hickory, correction="Ripley")
plot(K)
Berdasarkan grafik disamping dapat diidentifikasi bahwa garis data empirik cenderung lebih besar garis teoritis, sehingga dapat disimpulkan bahwa secara grafik, titik-titik menyebar secara berkelompok (kluster).
E<-envelope(dt_hickory,Kest, nsim=99)
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.
plot(E)
Berdasarkan grafik disamping dapat diidentifikasi bahwa garis data empirik cenderung lebih besar garis teoritis, sehingga dapat disimpulkan bahwa secara grafik, titik-titik menyebar secara berkelompok (kluster).
H0: Titik menyebar acak
H1: Titik tidak menyebar acak (uniform atau kluster)
help("mad.test")
## starting httpd help server ... done
mad.test(dt_hickory, Kest, nsim=99, alternative="two.sided")
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.
##
## Maximum absolute deviation test of CSR
## Monte Carlo test based on 99 simulations
## Summary function: K(r)
## Reference function: theoretical
## Alternative: two.sided
## Interval of distance values: [0, 0.25] units (one unit = 924 feet)
## Test statistic: Maximum absolute deviation
## Deviation = observed minus theoretical
##
## data: dt_hickory
## mad = 0.033188, rank = 1, p-value = 0.01
Berdasarkan hasil Maximum Absolute Deviation Test (Mad test) diperoleh p-value = 0,01 yang lebih kecil dari 0.05 maka Tolak H0, artinya titik-titik tidak menyebar acak.
H0: Titik menyebar acak atau cluster
H1: Titik menyebar uniform
mad.test(dt_hickory, Kest, nsim=99, alternative="less")
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.
##
## Maximum signed deviation test of CSR
## Monte Carlo test based on 99 simulations
## Summary function: K(r)
## Reference function: theoretical
## Alternative: less
## Interval of distance values: [0, 0.25] units (one unit = 924 feet)
## Test statistic: Maximum signed deviation
## Deviation = observed minus theoretical
##
## data: dt_hickory
## mad = -1.0566e-06, rank = 100, p-value = 1
Berdasarkan hasil Maximum Absolute Deviation Test (Mad test) diperoleh p-value = 1 yang lebih besar dari 0.05 maka gagal Tolak H0, artinya titik-titik tidak menyebar regular.
H0: Titik menyebar acak atau uniform
H1: Titik menyebar cluster
mad.test(dt_hickory, Kest, nsim=99, alternative="greater")
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.
##
## Maximum signed deviation test of CSR
## Monte Carlo test based on 99 simulations
## Summary function: K(r)
## Reference function: theoretical
## Alternative: greater
## Interval of distance values: [0, 0.25] units (one unit = 924 feet)
## Test statistic: Maximum signed deviation
## Deviation = observed minus theoretical
##
## data: dt_hickory
## mad = 0.033188, rank = 1, p-value = 0.01
Berdasarkan hasil Maximum Absolute Deviation Test (Mad test) diperoleh p-value = 0.01 yang lebih kecil dari 0.05 maka Tolak H0, artinya titik-titik menyebar cluster.