Artikel ini membahas penggunaan R dalam eksplorasi parameter dan fungsi dalam konteks kalkulus. Dilengkapi dengan contoh pengkodean menggunakan paket-paket seperti mosaicCalc dan dplyr, pembaca akan mendapatkan pemahaman lebih dalam tentang konsep ini.
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
## The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
## which was just loaded, will retire in October 2023.
## Please refer to R-spatial evolution reports for details, especially
## https://r-spatial.org/r/2023/05/15/evolution4.html.
## It may be desirable to make the sf package available;
## package maintainers should consider adding sf to Suggests:.
## The sp package is now running under evolution status 2
## (status 2 uses the sf package in place of rgdal)
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
f1 <- spliner(height ~ age, data = datasets::Loblolly)
## Warning in regularize.values(x, y, ties, missing(ties)): collapsing to unique
## 'x' values
f1(age = 8)
## [1] 20.68193
f2 <- connector(height ~ age, data = datasets::Loblolly)
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values
f2(age = 8)
## [1] 20.54729
gf_point(height ~ age, data = datasets::Loblolly) %>%
slice_plot(f1(age) ~ age) %>%
slice_plot(f2(age) ~ age, color = "yellow")
library(mosaicCalc)
Contoh Penggunaan Smoother:
# Loading data Cherry
library(datasets)
data("trees")
Cherry <- trees
g5 <- smoother(Volume ~ Girth + Height, data = Cherry, span = 0.8)
gf_point(Height ~ Girth, data = Cherry) %>%
contour_plot(g5(Girth, Height) ~ Girth + Height) %>%
gf_labs(x = "Girth (inches)", y = "Height (ft)", title = "Volume (ft^3)")
Analisis Nol Fungsi:
g <- makeFun(4 + exp(k * t) - 2^(b * t) ~ b, k = 0.00035, t = 1)
findZeros(g(b) ~ b, xlim = range(-1000, 1000)) # Output: b = 2.322
## b
## 1 2.322
findZeros(sin(cos(x^2) - x) - x - 0.5 ~ x, xlim = range(-50, 70)) # Output: x = 0.2098
## x
## 1 0.2098
Kesimpulan: Pemanfaatan R dalam analisis parameter dan fungsi dalam kalkulus memberikan fleksibilitas dan kemudahan dalam eksplorasi data. Contoh-contoh pengkodean yang disertakan memberikan panduan praktis bagi pembaca untuk mengimplementasikan konsep-konsep ini dalam analisis mereka.