Learn R Programming

registr (version 1.0.0)

registr: Register Exponential Family Functional Data

Description

Software for registering functional data from the exponential family of distributions.

Function used in the registration step of an FPCA-based approach for registering exponential-family functional data, called by register_fpca. This method uses constrained optimization to estimate spline coefficients for warping functions, where the objective function for optimization comes from maximizing the EF likelihood subject to monotonicity constraints on the warping functions. You have to either specify obj, which is a fpca object from an earlier step, or Y, a dataframe in long format with variables id, index, and value to indicate subject IDs, times, and observations, respectively.

Usage

registr(
  obj = NULL,
  Y = NULL,
  Kt = 8,
  Kh = 4,
  family = "binomial",
  gradient = TRUE,
  beta = NULL,
  t_min = NULL,
  t_max = NULL,
  row_obj = NULL,
  parametric_warps = FALSE,
  ...
)

Value

An object of class fpca containing:

Y

The observed data. The variable index is the new estimated time domain.

loss

Value of the loss function after registraton.

beta

Matrix of B-spline basis coefficients used to construct subject-specific warping functions.

Arguments

obj

Current estimate of FPC object. Can be NULL only if Y argument is selected.

Y

Dataframe. Should have values id, value, index.

Kt

Number of B-spline basis functions used to estimate mean functions. Default is 8.

Kh

Number of B-spline basis functions used to estimate warping functions h. Default is 4.

family

gaussian or binomial.

gradient

if TRUE, uses analytic gradient to calculate derivative. If FALSE, calculates gradient numerically.

beta

Current estimates for beta for each subject. Default is NULL.

t_min

Minimum value to be evaluated on the time domain. if `NULL`, taken to be minimum observed value.

t_max

Maximum value to be evaluated on the time domain. if `NULL`, taken to be maximum observed value.

row_obj

If NULL, the function cleans the data and calculates row indices. Keep this NULL if you are using standalone registr function.

parametric_warps

If FALSE (default), inverse warping functions are estimated nonparametrically. If 'beta_cdf', they are assumed to have the form of a Beta(a,b) CDF. If 'piecewise' they follow a piecewise parameterized function.

...

additional arguments passed to or from other functions

Author

Julia Wrobel

Julia Wrobel jw3134@cumc.columbia.edu

Examples

Run this code
Y = simulate_unregistered_curves()
register_step = registr(obj = NULL, Y = Y, Kt = 6, Kh = 3, family = "binomial", 
   gradient = TRUE)
testthat::expect_error({
registr(obj = list(Y = Y), Kt = 6, Kh = 3, family = "binomial", 
   gradient = TRUE)
})
testthat::expect_error({
registr(obj = NULL, Y = Y, Kt = 2, Kh = 3)
})
testthat::expect_error({
registr(obj = NULL, Y = Y, Kt = 6, Kh = 2)
})
# \donttest{
Y = simulate_unregistered_curves()
register_step = registr(obj = NULL, Y = Y, Kt = 6, Kh = 3, family = "binomial", 
   gradient = TRUE)
# }

Run the code above in your browser using DataLab