STUDI KASUS
Pada studi kasus kali ini model yang akan digunakan merupakan model
dengan 3 bentuk interaksi yaitu: tanaman
u , herbivora
v , dan karnivora
w .
library(mosaicCalc)
## Loading required package: mosaic
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## The 'mosaic' package masks several functions from core packages in order to add
## additional features. The original behavior of these functions should not be affected by this.
##
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following object is masked from 'package:Matrix':
##
## mean
## The following object is masked from 'package:ggplot2':
##
## stat
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
## quantile, sd, t.test, var
## The following objects are masked from 'package:base':
##
## max, mean, min, prod, range, sample, sum
## Loading required package: mosaicCore
##
## Attaching package: 'mosaicCore'
## The following objects are masked from 'package:dplyr':
##
## count, tally
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
Membaca Data Dari Library
data(package=.packages(all.available = TRUE))
data(package="datasets")
# cek seluruh dataset dari seluruh library yg telah dimuat
data()
# cek 10 observasi teratas
head(iris, 10)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
## 7 4.6 3.4 1.4 0.3 setosa
## 8 5.0 3.4 1.5 0.2 setosa
## 9 4.4 2.9 1.4 0.2 setosa
## 10 4.9 3.1 1.5 0.1 setosa
# cek 10 observasi terbawah
tail(iris, 10)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 141 6.7 3.1 5.6 2.4 virginica
## 142 6.9 3.1 5.1 2.3 virginica
## 143 5.8 2.7 5.1 1.9 virginica
## 144 6.8 3.2 5.9 2.3 virginica
## 145 6.7 3.3 5.7 2.5 virginica
## 146 6.7 3.0 5.2 2.3 virginica
## 147 6.3 2.5 5.0 1.9 virginica
## 148 6.5 3.0 5.2 2.0 virginica
## 149 6.2 3.4 5.4 2.3 virginica
## 150 5.9 3.0 5.1 1.8 virginica
# cek struktur data
str(iris)
## 'data.frame': 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
# ringkasan data
summary(iris)
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100
## 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300
## Median :5.800 Median :3.000 Median :4.350 Median :1.300
## Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199
## 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800
## Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500
## Species
## setosa :50
## versicolor:50
## virginica :50
##
##
##
attach(airquality)
# rata-rata konsentrasi ozon
mean(Ozone, na.rm = TRUE)
## [1] 42.12931
# median konsentrasi ozon
median(Ozone, na.rm = TRUE)
## [1] 31.5
# simpangan baku konsentrasi ozon
sd(Ozone, na.rm = TRUE)
## [1] 32.98788
# varians konsentrasi ozon
var(Ozone, na.rm = TRUE)
## [1] 1088.201
# range konsentrasi ozon
range(Ozone, na.rm = TRUE)
## [1] 1 168
# IQR konsentrasi ozon
IQR(Ozone, na.rm = TRUE)
## [1] 45.25
# kuartil 1, 2 dan 3 konsentrasi ozon
quantile(Ozone, probs = c(0.25, 0.5, 0.75), na.rm = TRUE)
## 25% 50% 75%
## 18.00 31.50 63.25
detach(airquality)
Referensi Bloomfield, V.A. 2014. Using R for Numerical Analysis in Science and Engineering. CRC Press. Coqhlan, A. Tanpa Tahun. Using R for Multivariate Analysis. https://little-book-of-r-for-multivariate-analysis.readthedocs.io/en/latest/src/multivariateanalysis.html#principal-component-analysis. Primartha, R. 2018. Belajar Machine Learning Teori dan Praktik. Penerbit Informatika : Bandung Rosadi,D. 2016. Analisis Statistika dengan R. Gadjah Mada University Press: Yogyakarta. Rosidi, M. 2019. Uji Hipotesis. https://environmental-data-modeling.netlify.com/tutorial/11_uji_hipotesis/. STHDA. Tanpa Tahun. Comparing Means in R. http://www.sthda.com/english/wiki/comparing-means-in-r.