---
title: "Introduction to rfastlowess"
pagetitle: "Introduction to rfastlowess"
author: "Amir Valizadeh"
date: "`r Sys.Date()`"
output: BiocStyle::html_document
vignette: >
%\VignetteIndexEntry{Introduction to rfastlowess}
%\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 LOWESS 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
`rfastlowess` is a high-performance R package for LOWESS (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("rfastlowess", 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(rfastlowess)
# Generate example data
set.seed(42)
x <- seq(0, 10, length.out = 100)
y <- sin(x) + rnorm(100, sd = 0.3)
# Initialize model
model <- Lowess(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 LowessResult")
# 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 <- Lowess(
fraction = 0.3,
iterations = 5,
confidence_intervals = 0.95
)$fit(x, y_outliers)
# Plot
plot(x, y_outliers, pch = 16, col = "gray", main = "Robust LOWESS")
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 |
|--------------------|--------------------------------------|
| `Lowess` | Primary interface - batch processing |
| `StreamingLowess` | Large datasets (>100K points) |
| `OnlineLowess` | 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()
```