groupedstats (version 0.0.7)

grouped_robustslr: Function to run robust simple linear regression (slr) on multiple variables across multiple grouping variables.

Description

Function to run robust simple linear regression (slr) on multiple variables across multiple grouping variables.

Usage

grouped_robustslr(data, dep.vars, indep.vars, grouping.vars, nrep = 1000,
  control = robust::lmRob.control(tlo = 1e-04, tua = 1.5e-06, mxr = 50,
  mxf = 50, mxs = 50, tl = 1e-06, estim = "Final", initial.alg = "Auto",
  final.alg = "MM", seed = 1313, level = 0.1, efficiency = 0.9, weight =
  c("Optimal", "Optimal"), trace = TRUE))

Arguments

data

Dataframe from which variables are to be taken.

dep.vars

List criterion or dependent variables for regression (y in y ~ x).

indep.vars

List predictor or independent variables for regression (x in y ~ x).

grouping.vars

List of grouping variables.

nrep

the number of random subsamples to be drawn. If "Exhaustive" resampling is being used, the value of nrep is ignored.

control

a list of control parameters to be used in the numerical algorithms. See lmRob.control for the possible control parameters and their default settings.

Value

A tibble dataframe with tidy results from robust linear regression analyses. The estimates are standardized, i.e. the lm model used is scale(y) ~ scale(x), and not y ~ x.

Examples

Run this code
# NOT RUN {
# in case of just one grouping variable
groupedstats::grouped_robustslr(
  data = iris,
  dep.vars = c(Sepal.Length, Petal.Length),
  indep.vars = c(Sepal.Width, Petal.Width),
  grouping.vars = Species
)
# }

Run the code above in your browser using DataCamp Workspace