Description Usage Arguments Details Value References See Also Examples
These are computing engines called by NGeDS
and GGeDS
, needed for
the underlying fitting procedures.
1 2 3 4 5 6 7 8 9 10 | UnivariateFitter(X, Y, Z = NULL, offset = rep(0, NROW(Y)),
weights = rep(1, length(X)), beta = 0.5, phi = 0.5, min.intknots = 0,
max.intknots = 300, q = 2, extr = range(X), show.iters = FALSE,
tol = as.double(1e-12), stoptype = c("SR", "RD", "LR"))
GenUnivariateFitter(X, Y, Z = NULL, offset = rep(0, NROW(Y)),
weights = rep(1, length(X)), family = gaussian(), beta = 0.5,
phi = 0.5, min.intknots = 0, max.intknots = 300, q = 2,
extr = range(X), show.iters = F, tol = as.double(1e-12),
stoptype = c("SR", "RD", "LR"))
|
X |
a numeric vector containing N sample values of the covariate chosen to enter the spline regression component of the predictor model. |
Y |
a vector of size N containing the observed values of the response variable y. |
Z |
a design matrix with N rows containing
other covariates selected to enter the parametric component of the predictor model
(see |
offset |
a vector of size N that can be used to specify a fixed covariate
to be included in the predictor model avoiding the estimation of its corresponding regression coefficient.
In case more than one covariate is fixed, the user should sum the corresponding coordinates of the fixed covariates
to produce one common N-vector of coordinates.
The |
weights |
an optional vector of size N of ‘prior weights’ to be put
on the observations in the fitting
process in case the user requires weighted GeDS fitting.
It is |
beta |
numeric parameter in the interval [0,1]
tuning the knot placement in stage A of GeDS. See the description of |
phi |
numeric parameter in the interval [0,1] specifying the threshold for
the stopping rule (model selector) in stage A of GeDS. See also |
min.intknots |
optional parameter allowing the user to set a minimum number of internal knots required. By default equal to zero. |
max.intknots |
optional parameter allowing the user to set a maximum number of internal knots to be added by the GeDS estimation algorithm. By default equal to the number of internal knots κ for the saturated GeDS model (i.e. κ=N-2). |
q |
numeric parameter which allows to fine-tune the stopping rule of stage A of GeDS, by default equal to 2.
See details in the description of |
extr |
numeric vector of 2 elements representing the left-most and right-most limits
of the interval embedding the sample values of |
show.iters |
logical variable indicating whether or not to print
information at each step. By default equal to |
tol |
numeric value indicating the tolerance to be used in the knot placement steps in stage A. By default equal to 1E-12. See details below. |
stoptype |
a character string indicating the type of GeDS stopping rule to
be used. It should be either |
family |
a description of the error distribution and link function to be used in the model. This can be a
character string naming a family function (e.g. |
The functions UnivariateFitter
and GenUnivariateFitter
are in general not intended to be used directly,
they should be called through NGeDS
and GGeDS
.
However, in case there is a need for multiple GeDS fitting (as may be the case e.g. in Monte Carlo simulations)
it may be efficient to use the fitters outside the main functions.
The argument tol
is used in the knot placement procedure of stage A of the GeDS algorithm in order to check
whether the current knot δ^* is set at an acceptable location or not.
If there exists a knot δ_i such that |δ^* - δ_i| < tol
,
δ^*, then the new knot is considered
to be coalescent with an existing one, it is discarded and the algorithm seeks alternative knot locations.
By default it is equal to 1e-12.
See NGeDS
and GGeDS
, Kaishev et al. (2016) and Dimitrova et al. (2017) for further details.
A GeDS-Class
object, but without the Formula
,
extcall
, terms
and znames
slots.
Kaishev, V.K., Dimitrova, D.S., Haberman, S., & Verrall, R.J. (2016).
Geometrically designed, variable knot regression splines.
Computational Statistics, 31, 1079–1105.
DOI: doi.org/10.1007/s00180-015-0621-7
Dimitrova, D.S., Kaishev, V.K., Lattuada A. and Verrall, R.J. (2017). Geometrically designed, variable knot splines in Generalized (Non-)Linear Models. Available at openaccess.city.ac.uk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # Examples similar to the ones
# presented in NGeDS and in GGeDS
# Generate a data sample for the response variable
# Y and the covariate X
set.seed(123)
N <- 500
f_1 <- function(x) (10*x/(1+100*x^2))*4+4
X <- sort(runif(N ,min = -2, max = 2))
# Specify a model for the mean of Y to include only
# a component non-linear in X, defined by the function f_1
means <- f_1(X)
# Add (Normal) noise to the mean of Y
Y <- rnorm(N, means, sd = 0.1)
# Fit a Normal GeDS regression model using the fitter function
(Gmod <- UnivariateFitter(X, Y, beta = 0.6, phi = 0.995,
extr = c(-2,2)))
##############################################################
# second: very similar example, but based on Poisson data
set.seed(123)
X <- sort(runif(N , min = -2, max = 2))
means <- exp(f_1(X))
Y <- rpois(N,means)
(Gmod2 <- GenUnivariateFitter(X, Y, beta = 0.2,
phi = 0.995, family = poisson(), extr = c(-2,2)))
# a plot showing quadratic and cubic fits,
# in the predictor scale
plot(X,log(Y), xlab = "x", ylab = expression(f[1](x)))
lines(Gmod2, n = 3, col = "red")
lines(Gmod2, n = 4, col = "blue", lty = 2)
legend("topleft", c("Quadratic","Cubic"),
col = c("red","blue"), lty = c(1,2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.