From where to download R
////////////////////////////////
 Formula:
           fv= pv * (1+r)^n

  fv: future value
  pv: present value
  r : the effective period rate
   n: the number of periods

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

Comment line and comment paragraph 
////////////////////////////////

fv_f<-function(pv,r,n){
"Objective: calculate the future value for a given present value
  formula used:  fv=pv*(1+r)^n
   Inputs  fv: future value
           pv: present value
           r : effective period rate
            n: number of periods

  Example #1: > fv_f(100,0.1,1)
  Example #2:> fv_f(r=0.1,fv=100,n=1)
  Example #3> fv_f(r=0.1,fv=100,1)
"; fv<-pv*(1+r)^n  
   return(fv)
}

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

3 ways to assign a value/values and how to show its value
////////////////////////////////
pv formula  
             fv
    pv = -------------
           (1+r)^n

     fv: future value
     pv: present value
     r : effective period rate
      n: number of periods

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

Use up and down arrow keys to recall the previous commands 
////////////////////////////////

pv_f<-function(fv,r,n){
"Objective: calculate the present value for a given future value
  formula used:  pv=fv/(1+r)^n
   Inputs  fv: future value
           pv: present value
           r : effective period rate
            n: number of periods
  Example #1: > pv_f(100,0.1,1)
               [1] 90.90909
  Example #2:> pv_f(r=0.1,fv=100,n=1)
               [1] 90.90909
  Example #3> pv_f(r=0.1,fv=100,1)
               [1] 90.90909
"; pv<-fv/(1+r)^n  
   return(pv)
}

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

PV(annuity)
////////////////////////////////
Annuity: the same cash flows
         at the same intervals
         for just n periods
         [if the first cash flows at 
               the end of the first period]
Cash flows
           c       c       c        c 
   |-------|-------|-------| ...    |
           1       2       3        n

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

Pastor and Stambaugh (2003) liquidity measure
////////////////////////////////
Basic logic:Pastor and Stambaugh (2003) design the following 
        regression to estimate individual stock s liquidity.  

            y(t)=alha + 1*x1(t-1)+  2*x2(t-1)+error(t)           (1)

    where,y(t) is the excess stock return on day t, the excess return is 
          defined as R(t)-Rm(t),  R(t) is the stock return, Rm(t) is the 
          market return at time t; x1(t-1) is the lagged stock return, 
          i.e., R(t-1), X2(t-1) is the lagged dollar trading volume, i.e., 
          x2(t-1)=P(t-1)*V(t-1), P(t-1) is the daily closing price of the stock 
          at t-1 and V(t-1) is the daily trading volume at t-1. 

 For more detail see the c30
///////////////////////////////