total risk, market risk and firm specific risk  
//////////////////////////////////////
Total risk has two components:
---------------------------
   total risk = market risk + firm-specific risk

        1) we use standard deviation of returns
                  to measure the total risk

        2) we use beta to measure the market risk
//////////////////////////////////////

What is the implied assumption behind
Do not put all your eggs into one basket?
//////////////////////////////////////
 The implied assumption that all your baskets would not 

      drop simultaneously. 

//////////////////////////////////////

Customizing your x-axis 
////////////////////////////////
# using n instead log(n) for the x-axis

set.seed(123)
n <- 1:100
y <- rnorm(100)

# Plot with log(n) on x-axis
plot(log(n), y, xaxt = "n", xlab = "n", ylab = "y")

# Customize x-axis to show n values
axis(1, at = log(n), labels = n)
//////////////////////////////////////

Appending to an existing file
////////////////////////////////

   write.table(x,file='c:/temp/test.txt')


   write.table(y,file='c:/temp/test.txt',append=TRUE)

  # Note that for some reason append=T is not working for write.csv

////////////////////////////////

variance vs. co-variance
//////////////////////////////////////
Variance of returns
-------------------
Assume that we have n returns: R1, R2, ... Rn
                     R1+ R2 + ... + Rn
            mean= ------------------------
                            n

             (R1-mean)^2 + (R2-mean)^2 + ... + (Rn-mean)^2
    var = -------------------------------------------
                                  n-1
    std = sqrt(var)

 covariance is defined as
------------------------
   We have n pairs of returns for two stocks A and B
    A:   R(A,1), R(A,2), ..... R(A, n)
    A:   R(B,1), R(B,2), ..... R(B, n)

    meanA is the mean of n returns from A
    meanB is the mean of n returns from B

               sum[ (R(A,i) - meanA)* (R(B,i)-meanB)]
   cov(A, B) = ---------------------------
                      n-1

  When A and B are the same, then covariance will become 
         variance, see below. 
               sum[ (R(A,i) - meanA)^2 ]

   var(A) = ---------------------------
                      n-1

  Note: variance of one stock could be viewed as a special case for covariance. 

//////////////////////////////////////