Oh silly me--and I've been staring at that for a good hour. Thank you and
I'll keep your advice in mind.

On Thu, Apr 28, 2011 at 6:24 PM, Andrew Robinson <
A.Robinson@ms.unimelb.edu.au> wrote:

> A couple of points here ....
>
> First, note that q doesn't increment in the code below.  So, you're
> getting the same variance each time.
>
> Second, note that (t$Rec1==input3 & t$Rec2==input4) evaluates to F?T
> or 0/1, and it's not clear from your code if that is what you intend.
>
> Finally, it's much easier to work with commented, minimal,
> self-contained, reproducible code.  Please consider submitting that
> with future questions.
>
> I hope that this helps,
>
> Andrew.
>
>
> On Thu, Apr 28, 2011 at 05:58:24PM -0400, Dat Mai wrote:
> > I'm trying to find the variance of various outputs in a matrix:
> >
> > for(l in 2:vl){
> >   for(o in 1:(l-1)){
> >
> >     # Make sure the inputs are for the matrix "m"
> >     input3=rownames(v)[o]
> >     input4=colnames(v)[l]
> >
> >     r=t[(t$Rec1==input3 & t$Rec2==input4),output]
> >
> >     if(length(r)==0){
> >       r=t[(t$Rec1==input4 & t$Rec2==input3),output]
> >     }
> >
> >     v[l,o]=var(q,na.rm=TRUE)
> >     v[o,l]=var(q,na.rm=TRUE)
> >     v[l,l]=var(q,na.rm=TRUE)
> >
> >   }
> > }
> >
> > Each output will yield multiple results, since each input length varies.
> > I'm not sure if this is the right way to go about finding the variance of
> > each pair, but this is what I've done.
> > The main issue I have with this now is that the results in every box in
> the
> > matrix yield the same exact number, even though that most likely
> shouldn't
> > happen.
> >
> > The question is: "How would I find the variance of each pair of inputs?"
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> --
> Andrew Robinson
> Program Manager, ACERA
> Department of Mathematics and Statistics            Tel: +61-3-8344-6410
> University of Melbourne, VIC 3010 Australia               (prefer email)
> http://www.ms.unimelb.edu.au/~andrewpr              Fax: +61-3-8344-4599
> http://www.acera.unimelb.edu.au/
>
> Forest Analytics with R (Springer, 2011)
> http://www.ms.unimelb.edu.au/FAwR/
> Introduction to Scientific Programming and Simulation using R (CRC, 2009):
> http://www.ms.unimelb.edu.au/spuRs/
>



-- 
Best,
Dat Mai
PhD Rotation Student
Albert Einstein College of Medicine

	[[alternative HTML version deleted]]

