Here are Matlab programs associated with (most of) my papers, in reverse chronological order.

#### Spatial kriging for replicated temporal point processes

The zip file Kriging_package contains Matlab programs to implement the spatial kriging prediction method proposed by Gervini (2021).

#### Joint models for grid point and response processes in longitudinal and functional data

The zip file COVMKPP_package contains Matlab programs for estimation of the covariation models proposed by Gervini and Baur (2020).

#### Doubly stochastic models for spatio-temporal covariation of replicated point processes

The zip file STPP_package contains Matlab programs for estimation of the models proposed by Gervini (2021). A brief tutorial is included.

#### Exploring patterns of demand in bike sharing systems

The zip file Bike_programs contains Matlab programs used in Gervini and Khanal (2019).

#### Multiplicative Component models for replicated point processes

The zip files Temporal_MCA_package and Spatial_MCA_package contain Matlab programs for fitting temporal and spatial Multiplicative Component models of Gervini (2017). Tutorials explaining how to use the programs are included.

#### Independent Component models for replicated point processes

The zip files Temporal_ICAPP_package and Spatial_ICAPP_package contain Matlab programs for fitting the temporal and spatial Independent Component models of Gervini (2016). They also include tutorials explaining how to use the programs.

#### Warped functional ANOVA

The zip file WFAnova_Matlab contains the Matlab programs (and compiled MEX Fortran subroutines) used in Gervini and Carter (2014). See *Readme.txt* file in the package for a brief description of the programs. Depending on your platform and your Matlab installation, you may need to re-compile the Fortran subroutines; the Fortran source files are in WFAnova_Fortran.

#### Warped functional regression

The zip file WFRe_package contains the Matlab programs (and Fortran subroutines) used in Gervini (2015, *Biometrika*). Depending on your platform and your Matlab installation, you may need to re-compile the Fortran subroutines. The main programs in the package are:

*runWFRe*: estimates models sequentially; normally you are only going to use this program for estimation*WFRe*: main program; does most of the computations, but is typically invoked through runWFRe and not directly*pred_WFRe*: computes predictors of new response curves given new covariates*bootWFRe*: bootstrap estimators of the regression coefficients, useful for estimating standard deviations*cv5_WFRe*: computes five-fold cross-validation prediction errors

#### Dynamic retrospective functional regression

The zip file DRFR_package contains the Matlab programs used in Gervini (2015, *Technometrics*). The main programs are:

*drfr*: computes estimators, by building models sequentially*drfr_boot_res*: bootstrapped estimators (using residual resampling)*drfr_cv5*: five-fold cross-validation for model selection*pred_drfr*: computes predictors of response trajectories given explanatory trajectories

#### GMt robust functional regression estimators

The Matlab functions GMt and boot_GMt compute the functional regression estimators of Gervini (2012, *ArXiv*) and their bootstrap versions for inference. They must be used in conjunction with the reduced-rank t-model programs given below.

#### Trimmed functional estimators

The Matlab functions fte and fte2 compute the trimmed mean and covariance estimators introduced in Gervini (2012, *Statistica Sinica*). The function fte.m handles univariate vector-valued functional data (that is, one-to-p functions, including of course the most common case p = 1). The function fte2.m is for bivariate real-valued data (that is, 2-to-1 surfaces, like EEM matrices).

#### Reduced-rank t models for sparse data

The Matlab functions in the .zip file FtMod_Matlab.zip compute reduced-rank t and Normal model estimators for the mean and principal components of curves observed on sparse, irregular grids (of course, they also work for regular grids). For details, see Gervini (2009).

An example of data analysis using these functions is given here.

#### Spatial median and spherical PCs

The following Matlab functions compute the spatial median and the spherical principal components (see Gervini 2008).

Spatial median: SpMed.m, Spherical PCs: SpPC.m, external function used: gsj.m

For quick comparison, RawPC.m computes the raw principal components.

An example of data analysis using these functions is given here.

#### Periodic shape-invariant models

This routine estimates the semiparametric shape-invariant models of Hürtgen and Gervini (2008).

**Download:** psim.m , bspl.m

#### Total-variation regularized logistic discrimination

Runs the regularized logistic discrimination of Rühlicke & Gervini (2008). For the time being, for two groups only.**
Download:** TVLogDis.m

#### Choosing PCs

This function computes the d-plot for selection of significant principal components. See Auer & Gervini (2008).**
Download: **dplot.m

#### Free-knot splines for functional data

Here are the Matlab functions used in Gervini (2006). FKSMEAN and FKSPC compute, respectively, free-knot spline estimates of the mean function and the principal components of a sample of univariate curves. Related subroutines are also given.

**Download:** fksmean.m, fkspc.m, spfpc.m, bspl.m and jupp.m

#### Nonparametric MLE of structural mean and warping functions

This is the estimator introduced in Gervini & Gasser (2005). MLREG computes the nonparametric MLE of the mean and related stuff (warping functions, registered curves, individual predictors of the parameters). BOOTMLREG bootstraps the estimator and is used to construct confidence bands.

**Download:** mlreg.m, bootmlreg.m

#### Self-modeling registration

Routine SMREG carries out self-modeling registration of functional data, as introduced in Gervini & Gasser (2004). The fast cross-validation procedure to select the number of components is implemented in FASTCV. Additionally, you need to download BSPL, which computes B-spline basis functions and their derivatives, and ISOTONE, which computes isotonic regression (I took this one from Jim Ramsay’s package).

**Download:** smreg.m, fastcv.m, bspl.m and isotone.m

#### Landmark registration and identification

Routine LANDREG performs (univariate) landmark registration. The curves are assumed to be sampled on a common time grid, although missing values are acceptable (missing landmarks are acceptable too).

For a quick-and-dirty graphical identification of landmarks, use LANDID.

**Download:** landreg.m, landid.m

#### REWLS estimator

Program REWLS computes the reweighted regression estimator of Gervini & Yohai (2002). As initial estimator I recommend the use of a high-breakdown S-estimator (computed by SREG) or alternatively the Least Median of Squares estimator (computed by LMSREG).

**Download:** rewls.m, sreg.m, lmsreg.m

Last updated: 30 Jun 2021, 21:30 hs