Novartis / xgxr

R package for supporting exploratory graphics at http://opensource.nibr.com/xgx
Other
13 stars 7 forks source link

xgx_conf_int should use length(y)-1 in calculated confidence interval istea #48

Closed iamstein closed 1 year ago

iamstein commented 2 years ago

In the script for xgx_conf_int, the function is coded as follows:

if (distribution == "normal") {
    mu <- mean(y)
    qtt <- stats::qt(percentile_value, length(y))
    s_v = sqrt(stats::var(y) / length(y))

    conf_int_out <- data.frame(
      y = mu,
      ymin = mu - qtt * s_v,
      ymax = mu + qtt * s_v
    )
}

Could you explain why it is 'length(y)' and not 'length(y) -1' as for a t distribution df should be 'n-1'?

iamstein commented 1 year ago

Issue has been resolved in version 1.1.3