# Create a spls.constraint object by fitting a constraint spls on a bootsPLS object

### Description

Create a spls.constraint object by fitting a constraint spls with the `spls.hybrid`

function on a ‘bootsPLS’ object

### Usage

1 | ```
fit.model(object,auto.tune,X,Y,ncomp,keepX.constraint,alpha,limit)
``` |

### Arguments

`object` |
a ‘spls.constraint’ object', as obtained from |

`auto.tune` |
Logical. If TRUE, tune the optimal number of component (ncomp) and which variables to select on each component (keepX.constraint). It only works with |

`X` |
Input matrix of dimension n * p; each row is an observation vector. |

`Y` |
Factor with at least q>2 levels. |

`ncomp` |
How many component are to be included in the sPLS-DA analysis? |

`keepX.constraint` |
A list containing which variables to keep on each component. |

`alpha` |
Level of the test. |

`limit` |
Vector of maximal number of genes to include on each component. |

### Details

This function fit a `spls.hybrid`

on the variables included in `keepX.constraint`

, which can be an input or internally calculated by setting `auto.tune=TRUE`

. If `object`

is given as an input, (X, Y) are ignored. If `auto.tune=TRUE`

, (ncomp, keepX.constraint) are ignored.

### Value

A 'spls.constraint' object is returned for which `plotIndiv`

is available.

The outputs are the ones from `spls.hybrid`

, plus

`data` |
A list of the input data X, Y, Y.mat (dummy matrix) and of keepX.constraint, which is a list containing the variables kept on each component. |

### See Also

`prediction`

, `CI.prediction`

, `plotIndiv`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
## Not run:
data(MSC)
X=MSC$X
Y=MSC$Y
boot=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5)
# with a bootsPLS object and auto.tune=TRUE
fit=fit.model(boot,auto.tune=TRUE)
# with a bootsPLS object and ncomp=2
fit=fit.model(boot,ncomp=2)
# with a bootsPLS object and ncomp/keepX.constraint as input
keepX.constraint=fit$data$keepX.constraint
fit=fit.model(boot,ncomp=2,keepX.constraint=keepX.constraint)
# with no bootsPLS object
fit=fit.model(X=X,Y=Y,ncomp=2,keepX.constraint=keepX.constraint)# bootsPLS object
plotIndiv(fit,ind.names=FALSE,col=as.numeric(Y))
## End(Not run)
``` |