# Fits a mixture of Gaussian to a set of one dimensional points.

### Description

This is the workhorse function, essentially an R wrapper around a lot of C code. It fits GLM models to the data.

### Usage

1 2 3 4 5 6 7 8 9 10 11 | ```
CNV.fitModel(ncomp,
nind,
hyp = "H0",
data,
logit.offset,
design.matrix.mean,
design.matrix.variance,
design.matrix.disease,
pi.model = 0,
mix.model = 10,
control = list(tol = 1e-05, max.iter = 3000, min.freq= 4))
``` |

### Arguments

`ncomp` |
integer, number of components to fit to the data |

`nind` |
integer, total number of data points |

`hyp` |
Hypothesis, can be either H0 or H1 |

`data` |
The data frame containing the data, in an expanded form (one point per individual and copy number) |

`logit.offset` |
An option most users will not use. It sets an offset when fitting the logit model for the disease status. This is used to obtain a profile likelihood when the disease parameter beta varies. |

`design.matrix.mean` |
The design matrix that relate mean cluster locations with batch.copy numbers. |

`design.matrix.variance` |
The design matrix for the cluster variances. |

`design.matrix.disease` |
The design matrix for the disease model. |

`pi.model` |
0,1,2 fit disease, hetero and quantitative models respectively. |

`mix.model` |
Specifies model for the components. |

`control` |
A list of parameters that control the behavior of the fitting. |

### Details

The user is very unlikely to actually use that function which is meant as an internal routine, a wrapper around the C code of the package. This function is called by the more user friendly function CNVtest.binary.

### Value

`data` |
The input expanded data frame, but with the posterior probabilities estimated. |

`status` |
A marker of convergence |

### Author(s)

Vincent Plagnol vincent.plagnol@cimr.cam.ac.uk and Chris Barnes christopher.barnes@imperial.ac.uk

### See Also

CNVtest.binary