# k-Fold Crossvalidation for a mogavs model

### Description

Performs k-fold CV for a model of class `mogavs`

via the cvTools package.

### Usage

1 |

### Arguments

`mogavs` |
A model of class |

`nvar` |
The number of variables for which you want to run k-fold CV. |

`data` |
Used data set. |

`y_ind` |
The column number for the y-variable in the dataset. |

`K` |
Number of folds in the cross-validation, default K=10. |

`R` |
Number of repeats for the CV, default R=1. |

`order` |
Logical, whether the result should be sorted by the column |

### Details

Perform k-fold cross-validation for all the linear models with `nvar`

number of variables, which have been tried during the course of the genetic algorithm.

### Value

A data frame with the following columns:

`archInd` |
The row index of the linear model in the |

`formula` |
The formula of the linear model as a character string. |

`CVerror` |
The root mean square error of the model. |

`CVse` |
The standard error of the model across the |

### Author(s)

Tommi Pajala <tommi.pajala@aalto.fi>

### See Also

`mogavsToLinear`

### Examples

1 2 3 | ```
data(sampleData)
mod<-mogavs(y~.,data=sampleData,maxGenerations=20)
cv.mogavs(mod,nvar=3,data=sampleData,y_ind=1,K=10,R=1,order=FALSE)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.