# Cross-validation of a Linear Regression Model

### Description

Provides cross-validation of a linear regression model

### Usage

1 |

### Arguments

`form.lm` |
formula of the regression model. |

`data` |
data including outcome and covaraites. |

`m` |
the number of folds to be used in cross-validation. |

`seed` |
random starting number used to replicate cross-validation. |

### Details

This function finds the optimal order of the covariates power series through cross-validation.

### Value

`sumres` |
Sum of residual squares divided by degree of freedom. |

`df` |
Degree of freedom which equals to the number of valid predictions minus the number of parameters. |

`m` |
the number of folds to be used in cross-validation. |

`seed` |
The random seed. |

### Note

In making the code, we adopted part of the `CVlm`

in `DAAG`

(Maindonald and Braun, 2015).

https://cran.r-project.org/package=DAAG

### Author(s)

Weihua An, Departments of Sociology and Statistics, Indiana University Bloomington, weihuaan@indiana.edu.

Xuefu Wang, Department of Statistics, Indiana University Bloomington, wangxuef@umail.iu.edu.

### See Also

`larf`

, `npse`