xls.fit | R Documentation |
Almost the same interface as stats::lm
.
Just includes two parameters more, error_weights and error_ahead_level
xls.fit(formula, data, error_weights = NULL, error_ahead_level = 4)
formula |
An object of class "formula": a symbolic description of the model to be fitted. |
data |
A "data.frame" (with no missing values) object containing the variables in the model. |
error_weights |
A numeric vector including error weights by order. If NULL, it is created automatically by error_ahead_level amount, decreasing at equal intervals. |
error_ahead_level |
An integer which represents how many steps further the parameters will be optimized for each data point. |
A lm
object whose coefficients are optimized by the mentioned method.
df <- datasets::airquality ordered_df <- df[with(df,order(Month,Day)),] model <- xls.fit(Ozone ~ Solar.R + Wind + Temp,ordered_df, error_weights = c(0.4,0.3,0.2,0.1),error_ahead_level = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.