Joined: Sun Feb 16, 2003 7:29 pm Posts: 9839

lumpy gravy wrote: I know how you did it, but I'm not going to tell. a couple of hints... first for single variable, say you have a collection of points (x,y), where:
x = the number of concurrent zappa members logged in on the forum y = the date & approx. time of day... and you want the best line through them; the line will be: y = ax + b, where: a = (<xy><x><y>) / (<x^2><x>^2), probability of a zappa member being logged in and b = <y>  a<x> probability of a random guests viewing the forum
the randomness correlation coefficient 'r' is given by
r = (<xy><x><y>) / sqrt[(<x^2><x>^2) * (<y^2><y>^2) {wild & beighter1967}
in the above, the notation <xy> means 'average value of xy', in other words;
for each zappa member logged in, multiply x for that point times y (the guest viewing the forum) for that point, add up all the products, and divide by the number of points...
similarly, <x^2> is the mean value of x^2 you'll recognize the denominator of the expression for 'a' as the variance of x, so you could rewrite the formulas as:
a = (<xy><x><y>) / var(x) r = a * sqrt[var(x) / var(y)]
now for the multivariate version of the formulas; think of x as a vector, but y is still a scalar... y is a function of multiple variables of the 18,159 zappa forum memberlist and the 3,600 minutes in a day which together are called x.
use upper case [ ] letters for vectors and <•> for the dot product of two vectors:
A•x means A[1]*x[1] + A[2]*x[2] + ...
we're still looking for a linear relation between x and y, and now it's of the form y = A•x + b
since x is a vector of the 'n' quantity of zappa forum members logged in , we look for 'n' coefficients of proportionality, and make scalar 'a' into vector A• in the formula for A, the numerator becomes:
(<xy><x><y>)
this is easy to interpret; x is a vector, y is a scalar. every component of x is multiplied by the scalar y
but the denominator takes a little more thought; what do we mean by
(<xx>  <x><x>) ¿
this is a second rank tensor, which looks like a square matrix... and, if x has n components, then <xx> has n^2 components
the (i,j) component of this object is made by averaging <x{i}x{j}> over all the points in your sample which equals the number of minutes in one day
<x><x> is the matrix that you make just by multiplying out all possible combinations of the vectors x; the (i,j) component of <x><x> is given by:
<x{i}><x{j}>; in other words,
separately average the x{i} components for all points and the x{j} components for all points, then just multiply those two together based on the total zappa member logged in, guests viewing the zappa forum, and the duration of one day
<xx> and <x><x> are both matrices subtract one from the other to get the denominator matrix corresponding to var(x)
then you must divide this matrix into the numerator vector. the way to do this is to invert the matrix, then multiply... symbolically, you could write the steps this way:
let vector V = (<xy><x><y>) let matrix M = (<xx><x><x>)
then let vector A = inv(M) * V
also, r^2 = inv(M) * V
the inverse of the matrix M is another matrix; the product of that matrix with a vector is another vector
finally, b is just a scalar, and the formula for b is just as before, with a and x becoming vectors:
b = <y>  Aa•<x>...hope this helps
_________________

