gaynorr / AlphaSimR

R package for breeding program simulations
https://gaynorr.github.io/AlphaSimR/
Other
40 stars 17 forks source link

Add rate parameter to gamma distribution for QTL effects #156

Closed gregorgorjanc closed 9 months ago

gregorgorjanc commented 9 months ago

Is your feature request related to a problem? Please describe. SimParam$addTraitX allows for gamma distribution, but only its shape parameter, while gamma distribution is defined with shape and rate parameter.

Describe the solution you'd like We should add rate=1 to SimParam$addTraitX and pass it internally to sampAddEff (https://github.com/gaynorr/AlphaSimR/blob/695aef000a50061fcef36aad2d85f92b3db2aab5/R/Class-SimParam.R#L2372C20-L2372C20) and sampEpiEff (https://github.com/gaynorr/AlphaSimR/blob/695aef000a50061fcef36aad2d85f92b3db2aab5/R/Class-SimParam.R#L2394)

Describe alternatives you've considered We could think of passing any kind of distribution by using the FUN=rx so the sampXEff functions would call the FUN function to sample effects and then any distribution parameters could be passed to these sampXEff functions via ....

Any thoughts on adding the gamma's rate parameter?

gaynorr commented 9 months ago

The inability to specify this parameter is by design. The rate/scale parameter is addressed by AlphaSimR when it scales the magnitude of the effects to achieve a desired level of genetic variance. This is equivalent to how you don't supply the standard deviation for the Gaussian distribution.

gregorgorjanc commented 9 months ago

I added this into docs (I have now been asked a couple of times, so best to have it in the docs) and opened a PR #157 for this change, hence closing this issue