# [R] R help

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Apr 30 00:27:33 CEST 2003

```Rolf Turner <rolf at math.unb.ca> writes:

> Peter Dalgaard writes:
>
> > Shutnik <shutnik_xx at yahoo.co.uk> writes:
> >
> > >  Hello,
> > >  I have the normal random variables y(t)~N(mu, sigma.sq) and want
> > >  to decompose them into n normal variables:
> > >
> > >  y(t) = x(t,1) +
+ x(t,n)
>
> 	I presume this means y(t) = x(t,1) + ... + x(t,n)  (R.T.)
>
> > >
> > > x(t,i)~N(mu, sigma.sq/n)
>
> 	I presume you want x(t,i)~N(mu/n, sigma.sq/n),
> 	elsewise the question doesn't make sense.
>
> 	I also presume you want the x(t,i) to be independent,
> 	elsewise the question is trivial.                  (R.T.)
>
> > >
> > >  The problem is not as simple as can appear. All my experiments
> > >  didnt give me anything so far. Are there any tools to do this?
> > >
> >
> > This should work, provided I understand the problem correctly:
> >
> > x <- rnorm(n,sd=sqrt(sigma.sq/n))
> > x <- x - mean(x) + y/n
>
> I don't think it's that simple:  By my calculations,
>
> 	Var(x_i) = 2*sigma.sq/n - sigma.sq/n^2,  not sigma.sq/n.

Try again... Var(y/n) = sigma.sq/n^2, not sigma.sq/n so it cancels the
second term rather than doubling the first.

> I think the problem is actually fairly subtle (although I may
> be overlooking something simple).  Something like a Gramm-Schmidt
> approach should work, but I can't quite suss it out.

You just need to orhtogonalize against the vector (1,1,...,1), which
is what I did, effectively. The residuals x-mean(x) are independent of
mean(x) by the Fisher-Cochran theorem (if I remember the name
correctly...) and y/n has same distribution as mean(x) so you can
substitute y/n for mean(x) and paste things back together again.

But where does the t in y(t) and x(t,i) enter in all of this??

--
O__  ---- Peter Dalgaard             Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
(*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

```