# Simulation of CNV and discrete traits

### Description

This function simulates intensity for a CNV and a binary trait response for different scenarios

### Usage

1 | ```
simCNVdataBinary(n, mu.surrog, sd.surrog, w, p0, or, cnv.random = FALSE)
``` |

### Arguments

`n` |
number of simulated individuals |

`mu.surrog` |
a vector of intensity signal means for every copy number status |

`sd.surrog` |
a vector of intensity signal standard deviations for every copy number status |

`w` |
a vector of copy number status proportions |

`p0` |
prevalence of disease (trait) for populations with zero copies (reference category) |

`or` |
a vector of odds ratio for one, two,... copies respect to zero copies |

`cnv.random` |
A logical value. TRUE means that copy number status is drawn under a multinomial distribution with proportions indicated by 'w'. FALSE means that the real simulated frequency is always the same and is rounded to the most similar integer to the frequencies indicated by 'w'. Default value is FALSE |

### Details

This function is useful to calculate the power of association models with binary traits under different scenarios, e.g. setting different degrees of association (odds ratios), considering different degrees of uncertainty controlled by the distribution of intensity signal data, i.e. mean `mu.surrog`

, standard deviation `sd.surrog`

and proportion `w`

, etc.

### Value

Data frame with individual simulated data per row and with the following variables:

`resp` |
Trait (response) variable following a Bernoulli distribution given the CNV status |

`surrog` |
Signal intensity following a mixture of normals with means, standard deviations
and proportions specified by |

`cnv` |
True copy number status |

### See Also

`simCNVdataCaseCon`

,
`simCNVdataNorm`

,
`simCNVdataPois`

,
`simCNVdataWeibull`

,
`cnv`

,
`CNVassoc`

### Examples

1 2 3 4 5 6 7 8 9 | ```
maf<-0.3
set.seed(123)
simData<-simCNVdataBinary(n=1000, mu.surrog=c(0,0.5,1), sd.surrog=rep(0.15,3),
w=c((1-maf)^2,2*maf*(1-maf),maf^2), p0=0.1, or=c(1.3,1.3^2), cnv.random = FALSE)
CNV<-cnv(simData$surrog,mix.method="EMmixt")
getQualityScore(CNV,type="CNVtools")
mod<-CNVassoc(resp~CNV,data=simData,family="binomial")
CNVtest(mod)
summary(mod)
``` |

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