smooth_lss: Smooth predicted polarity scores by local polynomial...

View source: R/utils.R

smooth_lssR Documentation

Smooth predicted polarity scores by local polynomial regression

Description

Smooth predicted polarity scores by local polynomial regression

Usage

smooth_lss(
  x,
  lss_var = "fit",
  date_var = "date",
  span = 0.1,
  group = NULL,
  from = NULL,
  to = NULL,
  by = "day",
  engine = c("loess", "locfit"),
  ...
)

Arguments

x

a data.frame containing polarity scores and dates.

lss_var

the name of the column in x for polarity scores.

date_var

the name of the column in x for dates.

span

the level of smoothing.

group

the name of the column in x to smooth the data by group.

from, to, by

the the range and the internal of the smoothed scores; passed to seq.Date.

engine

specifies the function to be used for smoothing.

...

additional arguments passed to the smoothing function.

Details

Smoothing is performed using stats::loess() or locfit::locfit(). When the x has more than 10000 rows, it is usually better to choose the latter by setting engine = "locfit". In this case, span is passed to locfit::lp(nn = span).


koheiw/LSS documentation built on July 24, 2024, 6:31 p.m.