[R] Help with a simple subroutine

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Sep 9 11:03:11 CEST 2022


В Fri, 9 Sep 2022 16:46:00 +0800
"Steven T. Yen" <styen using ntu.edu.tw> пишет:

> I am expecting the line  t<-gamma/sgamma to produce two different
> values. But I confirm that it is doing
> tt<-gamma[1]/sgamma[1]

No, it just happens that gamma[1]/sgamma[1] is the same as
gamma[2]/sgamma[2], subject to rounding errors:

> +   gamma<-exp(b)
> +   vgamma<-gamma^2*v[2,2]
> +   sgamma<-sqrt(vgamma)
> +   t<-gamma/sgamma

t = gamma / sgamma = gamma / sqrt(gamma^2 * v[2,2]) =
  = gamma / (abs(gamma) * sqrt(v[2,2])) =
(given gamma = exp(b) > 0)
  = 1 / sqrt(v[2,2]).

-- 
Best regards,
Ivan



More information about the R-help mailing list