[R] Help with this topic
Thomas W Blackwell
tblackw at umich.edu
Tue Dec 2 04:01:40 CET 2003
Stephen -
If the four columns shown below are in this order in a data
frame named 'data', then use
covariances <- by(data[ ,-1], data$Class, cov)
to get the covariance matrices within each of the four classes.
Alternative functions would be tapply() or aggregate(), but
the syntax for by() is easiest to understand.
- tom blackwell - u michigan medical school - ann arbor -
On Mon, 1 Dec 2003, Stephen Opiyo wrote:
> Dear ladies and gentlemen,
>
> I would like to calculate autocovarinace and cross-covariance scores 1,
> 2 and 3 of four classes A, B, C and D. I am using acf and ccf from time
> sires library. My problem is that I can not separate my data among the
> classes A, B, C and D. When I calculated acf for Score 1, I got a wrong
> result. The reason being that instead of using ony 60, 40 and 20, the
> program use all the data in column under Score 1. What should I do to
> calculate acf and ccf scores for each class A, B, C and D according to
> he data below?
>
> Class Score 1 Score 2 Score 3
> A 60 11 21
> A 40 21 16
> A 20 16 18
> B 10 23 62
> B 16 8 13
> B 14 13 18
> C 22 15 22
> C 24 5 18
> C 24 12 12
> D 16 6 16
> D 12 3 8
> D 15 2 13
>
> Thanks for your help.
>
> SO
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list