Hybrid Data Constructor (hdClass
)
hdClass.Rd
Constructs an object of class hdClass
, representing hybrid data composed of multiple functional and/or raw variables.
Arguments
- hdlist
A list of
fdClass
,rdClass
, orimgClass
objects.- argval
Optional numeric vector of grid points along the rows. If
NULL
, it defaults to a uniform grid over 0 and 1.- Smoothing_parameter
Smoothing parameter(s) for the rows:
If 0, no smoothing is applied.
If a numeric value or vector, it is used directly.
If
NULL
, defaults to2^seq(-30, 5, length.out = 10)
for tuning.
- Sparsity_parameter
Sparsity parameter(s) for the rows:
If 0, no sparsity is applied.
If a numeric vector, it is used for tuning.
If
NULL
, a suitable default sequence is generated.
Details
The hdClass
is an S3 class for representing hybrid data, consisting of a list of functional (fdClass
), raw (rdClass
), or image (imgClass
) data objects.
The input list (
hdlist
) can contain a mix offdClass
,rdClass
, andimgClass
objects.All objects must have the same number of observations (i.e., same number of rows).
Image objects (
imgClass
) are interpreted as either functional or raw based on their internal class inheritance.
The resulting object is a matrix with column-wise concatenation of the input matrices and includes the following attributes:
GridPoints_u
: Row grid points.Smoothing_parameter
: Row smoothing parameter(s).Sparsity_parameter
: Row sparsity parameter(s).n_var
: Number of variables (i.e., number of objects inhdlist
).ncol
: Number of columns in each variable.Smoothing_parameter_col
: List of smoothing parameters for each variable.Sparsity_parameter_col
: List of sparsity parameters for each variable.GridPoints_v
: List of grid points (columns) for each variable.variable_types
: Character vector of type labels for each variable:"hd"
(functional) or"rd"
(raw).
Examples
fd_obj <- fdClass(matrix(rnorm(100), nrow = 10))
rd_obj <- rdClass(matrix(rnorm(100), nrow = 10))
hd_obj <- hdClass(
hdlist = list(fd_obj, rd_obj),
argval = seq(0, 1, length.out = 10),
Smoothing_parameter = 0.5,
Sparsity_parameter = 2
)
print(hd_obj)
#> Hybrid Data (hdClass) Object
#> ===================================
#> Dimensions : 10 rows x 20 columns
#> Number of Variables : 2
#> Columns per Variable : 10 | 10
#> -----------------------------------
#> Grid Points (Rows) : 0, 0.111111111111111, 0.222222222222222 , ..., 0.888888888888889, 1
#> Grid Points (Columns):
#> - Variable 1: 0.1, 0.2, 0.3 , ..., 0.9, 1
#> - Variable 2: NULL
#> Smoothing Parameter (Row): 0.5
#> Smoothing Parameters (Col):
#> - Variable 1: 0
#> - Variable 2: 0
#> Sparsity Parameter (Row): 2
#> Sparsity Parameters (Col):
#> - Variable 1: 0
#> - Variable 2: 0
#> ===================================
#> First few rows and columns of the data:
#> V1 V2 V3 V4 V5
#> [1,] 0.1065870 -0.31031012 0.3038483 0.1216206 -0.95362873
#> [2,] 1.1769142 -0.02010818 -0.1833885 -1.0780673 0.41626080
#> [3,] 0.4473912 -2.39020034 0.5596497 -1.1435657 0.11402961
#> [4,] 2.2729548 0.88986536 -0.1865538 -0.5296437 0.06391875
#> [5,] 0.1360582 -1.48281332 -0.8122754 -0.6812732 -0.91933224
attr(hd_obj, "variable_types") # Shows "hd", "rd", etc.
#> [1] "hd" "rd"