Description Usage Arguments Value Note Author(s) See Also Examples
The function allows to smooth the curves in a "IWTomicsData"
object,
to fill in gaps in the measurements, to change measurement resolutions and, when
region alignment is "scale"
, to measure the features in the different regions
on the same grid.
1 2 3 4 5 6 7 | ## S4 method for signature 'IWTomicsData'
smooth(x, type="locpoly",
id_regions_subset=idRegions(x), id_features_subset=idFeatures(x),
resolution_new=resolution(x)[id_features_subset],
scale_grid=unlist(lapply(lengthFeatures(x)[id_features_subset],
function(length) max(unlist(length[id_regions_subset])))),
fill_gaps=TRUE, bandwidth=5, degree=3, dist_knots=10, parallel=FALSE)
|
x |
|
type |
type of smoothing used. Possible types are:
|
id_regions_subset |
vector with the identifiers of the region datasets to be smoothed. |
id_features_subset |
vector with the identifiers of the features to be smoothed. |
resolution_new |
resolution used to evaluate smoothed curves. As default, measurement
resolution is mainteined after smoothing and smoothed curves are evaluated on the
same grid as the raw curves. Can be either a constant (the same resolution for all
features) or a vector of constants (a resolution for each feature). Not used if
region alignment is |
scale_grid |
number of equally-spaced grid points over which the smoothed curves
are evaluated. Can be either a constant (the same grid for all features) or a vector
of constants (a grid for each feature). Only used if region alignment is |
fill_gaps |
if |
bandwidth |
bandwidth smoothing parameter used in |
degree |
degree of local polynomial or b-splines used in |
dist_knots |
(approximate) distance between knots defining the b-splines used
in |
parallel |
if |
smooth
returns a "IWTomicsData"
object with smoothed curves and
updated resolutions and lengths (without the optional slot test
).
If the regions have different lengths and/or gaps are present in the feature
measurements (NA
measurements), "splines"
type smoothing is very
computational expensive. In this case we suggest to use "locpoly"
or "kernel"
type smoothing to smooth a large number of curves.
Marzia A Cremona, Alessia Pini, Francesca Chiaromonte, Simone Vantini
IWTomicsData
for "IWTomicsData"
class, constructors, accessors and methods;
plot
method to plot "IWTomicsData"
objects;
IWTomicsTest
for the Interval-Wise Testing.
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 36 37 38 39 40 41 42 43 44 | ## -------------------------------------------------------------------------------------------
## -------------------------------------------------------------------------------------------
## CURVE ALIGNMENT CENTER
## -------------------------------------------------------------------------------------------
## -------------------------------------------------------------------------------------------
data(regionsFeatures_center)
dev.new()
plot(regionsFeatures_center,type='curves',N_regions=lengthRegions(regionsFeatures_center))
## Smooth all the curves with local polynomials
regionsFeatures_smooth=smooth(regionsFeatures_center,type='locpoly')
plot(regionsFeatures_smooth,type='curves',N_regions=lengthRegions(regionsFeatures_smooth))
## Smooth only feature 'ftr1', only region datasets 'elem3' and 'control'
regionsFeatures_smooth=smooth(regionsFeatures_center,type='locpoly',id_features_subset='ftr1',
id_regions_subset=c('elem3','control'))
plot(regionsFeatures_smooth,type='curves',N_regions=lengthRegions(regionsFeatures_smooth))
## Smooth only feature 'ftr1' and change its resolution
regionsFeatures_smooth=smooth(regionsFeatures_center,type='locpoly',id_features_subset='ftr1',
resolution_new=4000)
plot(regionsFeatures_smooth,type='curves',N_regions=lengthRegions(regionsFeatures_smooth))
## Smooth without filling gaps
regionsFeatures_smooth=smooth(regionsFeatures_center,type='locpoly',fill_gaps=FALSE)
plot(regionsFeatures_smooth,type='curves',N_regions=lengthRegions(regionsFeatures_smooth))
## -------------------------------------------------------------------------------------------
## -------------------------------------------------------------------------------------------
## CURVE ALIGNMENT SCALE
## -------------------------------------------------------------------------------------------
## -------------------------------------------------------------------------------------------
data(regionsFeatures_scale)
dev.new()
plot(regionsFeatures_scale,type='curves',N_regions=lengthRegions(regionsFeatures_scale),
average=FALSE,size=FALSE)
## Smooth all the curves with local polynomials
regionsFeatures_smooth=smooth(regionsFeatures_scale,type='locpoly')
## Plot of the smoothed curves
plot(regionsFeatures_smooth,type='curves',N_regions=lengthRegions(regionsFeatures_smooth),
average=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.