Looks for the model with the minimal min_fn
within the flex_param span.
prNlChooseDf(
model,
flex_param,
variable,
spline_fn,
min_fn,
simplest_nonlinear,
verbal,
workers,
libraries
)
The model that is to be evaluated and adapted for non-linearity
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.
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.
Either a string or a function that is to be used for testing alternative non-linearity models
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()
.
The simplest non-linear form that the ANOVA has been tested against
Set this to TRUE
if you want print statements with the
anova test and the chosen knots.
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.
If we use the parallel approach we need to make sure that the right libraries are available in the threads