lm.contribution: Outputs the contribution of each lm independent variable

Description Usage Arguments Examples

View source: R/lm.contribution.R

Description

Takes a lm and applies coefficients to show how each independent variable contributes to the dependent variable. IMPORTANT: lm(data = ?) has to be a data.table.

Usage

1
lm.contribution(lm.object, date.index = "Week")

Arguments

lm.object

lm object. A lm saved to a variable.

date.index

Character. The date index of the lm(data = ?) variable.

Examples

1
2
3
4
5
x <- data.table::fread(system.file("extdata", "lm.csv", package = "nladwa"))
x[, Week := excelDateToRDate(Week)]
lm.x <- lm(TotalGrossLeads ~ Search.Spend + Competitor.Spend, data = x)
lm.object <- lm.contribution(lm.object = lm.x, date.index = "Week")
print(lm.object)

Braja93/braja documentation built on June 1, 2017, 5:19 p.m.