Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

classif.gsam

Classification Fitting Functional Generalized Additive Models


Description

Computes functional classification using functional (and non functional) explanatory variables by basis representation.

Usage

classif.gsam(
  formula,
  data,
  family = binomial(),
  weights = "equal",
  basis.x = NULL,
  CV = FALSE,
  prob = 0.5,
  type = "1vsall",
  ...
)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under Details.

data

List that containing the variables in the model.

family

a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See family for details of family functions.)

weights

Weights:

  • if character string ='equal' same weights for each observation (by default) and ='inverse' for inverse-probability of weighting.

  • if numeric vector of length n, Weight values of each observation.

basis.x

List of basis for functional explanatory data estimation.

CV

=TRUE, Cross-validation (CV) is done.

prob

probability value used for binari discriminant.

type

If type is"1vsall" (by default) a maximum probability scheme is applied: requires G binary classifiers. If type is "majority" (only for multicalss classification G > 2) a voting scheme is applied: requires G (G - 1) / 2 binary classifiers.

...

Further arguments passed to or from other methods.

Details

The first item in the data list is called "df" and is a data frame with the response and non functional explanatory variables, as glm.

Functional covariates of class fdata or fd are introduced in the following items in the data list.
basis.x is a list of basis for represent each functional covariate. The basis object can be created by the function: create.pc.basis, pca.fd create.pc.basis, create.fdata.basis o create.basis.

Value

Return gam object plus:

  • formula formula.

  • data List that containing the variables in the model.

  • group Factor of length n

  • group.est Estimated vector groups

  • prob.classification Probability of correct classification by group.

  • prob.group Matrix of predicted class probabilities. For each functional point shows the probability of each possible group membership.

  • max.prob Highest probability of correct classification.

  • type Type of classification scheme: 1 vs all or majority voting.

Note

If the formula only contains a non functional explanatory variables (multivariate covariates), the function compute a standard glm procedure.

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@usc.es

References

Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.

McCullagh and Nelder (1989), Generalized Linear Models 2nd ed. Chapman and Hall.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S, New York: Springer. Regression for R. R News 1(2):20-25

See Also

See Also as: fregre.gsam.
Alternative method: classif.np, classif.glm and classif.gkam.

Examples

## Not run: 
require(fda.usc)
data(phoneme)
mlearn<-phoneme[["learn"]]
glearn<-phoneme[["classlearn"]]
mtest<-phoneme[["test"]]
gtest<-phoneme[["classtest"]]
dataf<-data.frame(glearn)
dat=list("df"=dataf,"x"=mlearn)
a1<-classif.gsam(glearn~s(x,k=3),data=dat)
summary(a1)
newdat<-list("x"=mtest)
p1<-predict(a1,newdat)
table(gtest,p1)
sum(p1==gtest)/250

## End(Not run)

fda.usc

Functional Data Analysis and Utilities for Statistical Computing

v2.0.2
GPL-2
Authors
Manuel Febrero Bande [aut], Manuel Oviedo de la Fuente [aut, cre], Pedro Galeano [ctb], Alicia Nieto [ctb], Eduardo Garcia-Portugues [ctb]
Initial release
2020-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.