parametrization of R function rlnorm [🇷 for BE/BA]
Hi Martin and all,
Sorry to embark on archaelogy.
Well.... Is that really something anyone wants to do?
When we simulate BE, like in crossover trials, we most likely want to simulate with a known geometric mean ratio on the observed scale and a known CV on the observed scale.
I could have misunderstood
Stuff like that really hurts.
I would any day prefer to use
Let me add that for those who simulate Test and Ref data individually (yes, there are still backward people who do that), the subtraction of something like
Sorry to embark on archaelogy.
❝ When you want to generate log-normal distributed random variables with a given mean and CV on the observed scale - I suggest to use meanlog=log(mean)-0.5*log(1+cv^2)
instead of meanlog=log(mean)
.
❝
❝ # example
❝ set.seed(020510)
❝ n <- 1E6
❝ mue <- 5
❝ cv <- 0.5
❝
❝ x <- rlnorm(n=n, meanlog=log(mue)-0.5*log(1+cv^2), sdlog=sqrt(log(1+cv^2)))
❝ y <- rlnorm(n=n, meanlog=log(mue), sdlog=sqrt(log(1+cv^2)))
❝
❝ mean(x); sd(x)/mean(x)
❝ mean(y); sd(y)/mean(y)
Well.... Is that really something anyone wants to do?
When we simulate BE, like in crossover trials, we most likely want to simulate with a known geometric mean ratio on the observed scale and a known CV on the observed scale.
I could have misunderstood
rlnorm
entirely, but otherwise: GeoMean=function(a)
{
return (exp(mean(log(a))))
}
set.seed(020510)
n <- 1E6
GMR <- 0.95
cv <- 0.5
x <- rlnorm(n=n, meanlog=log(GMR)-0.5*log(1+cv^2), sdlog=sqrt(log(1+cv^2)))
y <- rlnorm(n=n, meanlog=log(GMR), sdlog=sqrt(log(1+cv^2)))
mean(x); sd(x)/mean(x)
mean(y); sd(y)/mean(y)
GeoMean(x)
GeoMean(y)
Stuff like that really hurts.
I would any day prefer to use
rnorm
to avoid the confusion:logTRratios=rnorm(n=1e6, mean=log(0.95), sd=sqrt(log(1+cv^2)))
TRratios=exp(logTRratios)
GeoMean(TRratios) ##Geometric mean observed scale
mean(TRratios) ##useless?
mean(logTRratios) ## close to log(0.95)
sd(TRratios)/mean(TRratios)
Let me add that for those who simulate Test and Ref data individually (yes, there are still backward people who do that), the subtraction of something like
0.5*log(1+cv^2)
will cancel out as long as a common variance term is used and balance is present because log(T)-log(R)=log(T/R).—
Pass or fail!
ElMaestro
Pass or fail!
ElMaestro
Complete thread:
- Parallel bears meeting at random in infinity d_labes 2010-04-22 11:43 [🇷 for BE/BA]
- Parallel bears meeting at random in infinity ElMaestro 2010-04-22 12:53
- Parallel groups in bear - CIs d_labes 2010-04-22 14:00
- Parallel groups in bear - CIs ElMaestro 2010-04-22 21:47
- Parallel groups in bear - CIs d_labes 2010-04-23 09:09
- Parallel groups in bear - CIs yjlee168 2010-04-25 23:29
- Parallel groups in bear - CIs ElMaestro 2010-04-22 21:47
- Parallel groups in bear - CIs d_labes 2010-04-22 14:00
- Parallel bears meeting at random in infinity yjlee168 2010-04-22 23:09
- Modelling Parallel bears d_labes 2010-04-23 09:12
- Modelling Parallel bears yjlee168 2010-04-23 21:14
- Validating vs. WinNonlin... Helmut 2010-04-24 00:28
- Validating vs. WinNonlin... yjlee168 2010-04-24 19:36
- Validating vs. WinNonlin... yjlee168 2010-04-26 00:09
- Validating vs. WinNonlin... Helmut 2010-04-26 01:29
- WNL in replicate BE yjlee168 2010-04-26 08:59
- WNL in replicate BE Helmut 2010-04-26 16:15
- WNL in replicate BE yjlee168 2010-04-26 08:59
- Validating vs. WinNonlin... Helmut 2010-04-26 01:29
- Modelling Parallel bears yjlee168 2010-04-25 19:34
- Modelling Parallel bears ElMaestro 2010-04-25 20:40
- Dataset Helmut 2010-04-25 22:38
- Dataset yjlee168 2010-04-25 22:44
- Dataset Helmut 2010-04-26 01:13
- Dataset yjlee168 2010-04-26 08:16
- NCA → Statistical analysis for parallel study Helmut 2010-04-26 13:12
- NCA → Statistical analysis for parallel study yjlee168 2010-04-26 18:43
- NCA → Statistical analysis for parallel study Helmut 2010-04-26 13:12
- Dataset yjlee168 2010-04-26 08:16
- Dataset Helmut 2010-04-26 01:13
- dilemma yjlee168 2010-04-26 08:41
- Equal variances d_labes 2010-04-26 09:04
- Equal variances yjlee168 2010-04-26 09:22
- GLM = Equal variances d_labes 2010-04-26 13:29
- GLM = Equal variances Helmut 2010-04-26 14:45
- I'm a believer d_labes 2010-04-26 15:58
- I'm a believer Helmut 2010-04-26 16:31
- I'm a believer d_labes 2010-04-26 15:58
- GLM = Equal variances Helmut 2010-04-26 14:45
- GLM = Equal variances d_labes 2010-04-26 13:29
- Equal variances Helmut 2010-04-26 12:55
- gls() for unequal variances? d_labes 2010-04-26 16:36
- gls() for unequal variances? Helmut 2010-04-26 17:00
- Sims Helmut 2010-04-27 01:36
- Sandwich - Simsalabim d_labes 2010-04-28 10:58
- Sandwich - Simsalabim Helmut 2010-04-28 14:19
- parametrization of R function rlnorm martin 2010-05-02 18:22
- Mean of log-normal d_labes 2010-05-03 16:22
- parametrization of R function rlnormElMaestro 2013-07-26 21:42
- Martin‽ Helmut 2013-07-28 02:01
- Sandwich - Simsalabim d_labes 2010-04-28 10:58
- gls() for unequal variances? d_labes 2010-04-26 16:36
- Equal variances yjlee168 2010-04-26 09:22
- Dataset yjlee168 2010-04-25 22:44
- Validating vs. WinNonlin... Helmut 2010-04-24 00:28
- Modelling Parallel bears yjlee168 2010-04-23 21:14
- Modelling Parallel bears d_labes 2010-04-23 09:12
- Parallel bears meeting at random in infinity ElMaestro 2010-04-22 12:53