Centers classes in data to the mean of each class.
- [ccx,mn,cls,npercls] = classcenter(x,classset); %calibrate using classset
- ccx = classcenter(x,mn,cls); %apply (classset = 1)
- ccx = classcenter(x,classset,mn,cls); %apply using specific classset
Rows in the input data are centered by class. The result is that each class in the output will have mean response of zero. If no classes are present or all rows belong to the same class, this is equivalent to mean centering. For more details, see Advanced_Preprocessing:_Variable_Centering.
- x = DataSet object to be class-centered.
- classset = Class set (from rows) which should be used to center data. Default is class set 1.
- mn = Means from previous call to classcenter. Must be passed with associated classes (see next input)
- cls = Classes associated with each mean (see previous). Used to apply previously-calculated means to new data.
- ccx = Class-centered x. Dataset where each class has been centered.
- mn = Row vectors of means for each class.
- cls = Class numbers associated with each row of mn.
- npercls = Number of contributing samples in each centered class.
Use in Multilevel Classification and Regression
Classcenter can be used in multi-level classification. Multi-level data are data where samples have a class set and where samples within each class are also associated with a secondary class set. Patient data is an example where measurements are taken from each patient before and after treatment. The primary class is patientID and the secondary class is "untreated"/"treated", as discussed in J.A. Westerhuis, Ewoud J.J., van Velzen H. C., Hoefsloot J., and Smilde A.K., "Multivariate paired data analysis: multilevel PLSDA versus OPLSDA" Metabolomics (2010) 6:119-128. Classcenter can similarly be used to perform class-centered regression.
Steps to do multilevel PLS
- assign classes to samples in x-block where each pair of measurements for a subject have the same class (i.e. measurements which have a common offset have same class)
- add class centering to preprocessing ("Class Center")
- use PLS / PLSDA / OPLS / OPLSDA to build model as usual