Learn R Programming

funcharts (version 1.8.0)

times_mfd: Pointwise product of multivariate functional data (and scalar multiplication)

Description

Computes the elementwise (pointwise) product of two objects of class mfd, returning an mfd on the same basis. If one object contains a single replication (one observation) and the other contains multiple, the single replication is recycled across observations before multiplication.

Usage

times_mfd(mfdobj1, mfdobj2)

# S3 method for mfd *(mfdobj1, mfdobj2)

Value

An object of class mfd whose coefficients are the pointwise product of the inputs (with recycling if needed). The basis is the common input basis. The fdnames are inherited from the input that supplies the observation indexing after any replication.

Arguments

mfdobj1, mfdobj2

Objects of class mfd defined on the same basis.

Details

Alternatively, it also compute the product of an mfd object with a numeric scalar.

Let coefficient arrays have dimensions \((nbasis, nobs, nvar)\). The function:

  • requires both inputs to be mfd objects;

  • requires identical basis systems (checked with identical());

  • requires the same number of variables;

  • for observations: if both \(nobs_1\) and \(nobs_2\) are greater than one, they must be equal; otherwise, the object with \(nobs = 1\) is replicated to match the other.

Internally, coefficient arrays are converted to fd objects and multiplied via times.fd, with basisobj set to the common basis so that the result is re-expanded on the same basis.

See Also

plus_mfd, minus_mfd, nobs, nvar, nbasis, times.fd, mfd

Examples

Run this code
# Assuming mfdobj_a and mfdobj_b are 'mfd' objects on the same basis:
# mfdobj_a * mfdobj_b   # elementwise product
# 2 * mfdobj_a          # scalar multiplication
# mfdobj_a * 0.5        # scalar multiplication

Run the code above in your browser using DataLab