---
title: "Introduction to rfastloess"
author: "Amir Valizadeh"
date: "`r Sys.Date()`"
output:
rmarkdown::html_document:
toc: true
vignette: >
%\VignetteIndexEntry{Introduction to rfastloess}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.width = 7,
fig.height = 5
)
```
```{r srr-tags, eval = FALSE, echo = FALSE}
#' @srrstats {G1.0} Package introduction with academic context.
#' @srrstats {G1.4} Examples use roxygen2-documented functions.
#' @srrstats {RE1.2} Documents expected numeric vector input format.
#' @srrstats {RE1.4} Documents LOESS assumptions and use cases.
#' @srrstats {RE4.17} Demonstrates print() method for model objects.
#' @srrstats {RE6.0, RE6.2} Demonstrates plot() method with CI visualization.
```
## Overview
`rfastloess` is a high-performance R package for LOESS (Locally Weighted
Scatterplot Smoothing) built on a Rust backend.
**Full documentation**:
## Installation
```{r installation, eval=FALSE}
# From R-universe (pre-built binaries, no Rust required)
install.packages("rfastloess", repos = "https://thisisamirv.r-universe.dev")
```
## Quick Start
### Basic Smoothing
The package uses S3 classes to provide a user-friendly interface.
Models and results can be inspected using `print()`.
Results can also be visualized using `plot()`.
```{r basic_example}
library(rfastloess)
# Generate example data
set.seed(42)
x <- seq(0, 10, length.out = 100)
y <- sin(x) + rnorm(100, sd = 0.3)
# Initialize model
model <- Loess(fraction = 0.3)
print(model)
# Fit model
result <- model$fit(x, y)
print(result)
# Quick visualization using the S3 plot method
plot(result, main = "Auto-plot of LoessResult")
# For custom plotting, access components directly
plot(x, y, pch = 16, col = "gray", main = "Manual Overlay")
lines(result$x, result$y, col = "red", lwd = 2)
```
### Robust Smoothing with Intervals
```{r robust_example}
# Add outliers
y_outliers <- y
y_outliers[sample(1:100, 10)] <- y_outliers[sample(1:100, 10)] + 5
# Robust smoothing with confidence intervals
result_robust <- Loess(
fraction = 0.3,
iterations = 5,
confidence_intervals = 0.95
)$fit(x, y_outliers)
# Plot
plot(x, y_outliers, pch = 16, col = "gray", main = "Robust LOESS")
lines(result_robust$x, result_robust$y, col = "red", lwd = 2)
lines(result_robust$x, result_robust$confidence_lower, col = "blue", lty = 2)
lines(result_robust$x, result_robust$confidence_upper, col = "blue", lty = 2)
```
## Main Classes
| Class | Use Case |
| --- | --- |
| `Loess` | Primary interface - batch processing |
| `StreamingLoess` | Large datasets (>100K points) |
| `OnlineLoess` | Real-time data streams |
## Learn More
For comprehensive documentation including:
- Parameter selection guides
- Streaming and online processing tutorials
- Genomic data examples
- Performance benchmarks
Visit: ****
## Session Info
```{r session_info}
sessionInfo()
```