prNlChooseDf: Chooses the degrees of freedom for the non-linearity

Description Usage Arguments

View source: R/addNonlinearity.R

Description

Looks for the model with the minimal min_fn within the flex_param span.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
prNlChooseDf(
  model,
  flex_param,
  variable,
  spline_fn,
  min_fn,
  simplest_nonlinear,
  verbal,
  workers,
  libraries
)

Arguments

model

The model that is to be evaluated and adapted for non-linearity

flex_param

A vector with values that are to be tested as the default second parameter for the non-linearity function that you want to evaluate. This defaults to 2:7, for the ns() it tests the degrees of freedom ranging between 2 and 7.

variable

The name of the parameter that is to be tested for non-linearity. Note that the variable should be included plain (i.e. as a linear variable) form in the model.

spline_fn

Either a string or a function that is to be used for testing alternative non-linearity models

min_fn

This is the function that we want to minimized if the variable supports the non-linearity assumption. E.g. BIC() or AIC, note that the BIC() will in the majority of cases support a lower complexity than the AIC().

simplest_nonlinear

The simplest non-linear form that the ANOVA has been tested against

verbal

Set this to TRUE if you want print statements with the anova test and the chosen knots.

workers

The function tries to run everything in parallel. Under some circumstances you may want to restrict the number of parallel threads to less than the default detectCores() - 1, e.g. you may run out of memory then you can provide this parameter. If you do not want to use parallel then simply set workers to FALSE. The cluster created using makeCluster() function.

libraries

If we use the parallel approach we need to make sure that the right libraries are available in the threads


Greg documentation built on July 1, 2020, 6:59 p.m.