returns               package:fSeries               R Documentation

_C_a_l_c_u_l_a_t_i_o_n_s _o_f _F_i_n_a_n_c_i_a_l _R_e_t_u_r_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     Functions to calculate financial returns.

_U_s_a_g_e:

     returns(x, ...)

     ## Default S3 method:
     returns(x, method = c("continuous", "discrete", "compound", "simple"), 
         percentage = FALSE, ...)
     ## S3 method for class 'timeSeries':
     returns(x, method = c("continuous", "discrete", "compound", "simple"), 
         percentage = FALSE, na.rm = TRUE, trim = TRUE, ...)
     ## S3 method for class 'zoo':
     returns(x, method = c("continuous", "discrete", "compound", "simple"), 
         percentage = FALSE, na.rm = TRUE, trim = TRUE, ...)
         
     getReturns(...)
     returnSeries(...)

_A_r_g_u_m_e_n_t_s:

percentage: a logical value. By default 'FALSE', if 'TRUE' the  series
          will be expressed in percentage changes. 

  method: ... 

   na.rm: ... 

    trim: ... 

       x: an object of class 'timeSeries'. 

     ...: arguments to be passed. 

_V_a_l_u_e:

     all functions return an object of class 'timeSeries'.

_N_o_t_e:

     The functions 'returnSeries', 'getReturns',  are synonymes for
     'returns.timeSeries'.

_A_u_t_h_o_r(_s):

     Diethelm Wuertz for the Rmetrics R-port.

_E_x_a_m_p_l_e_s:

     ## data -  
        # Microsoft Data: 
        myFinCenter <<- "GMT"
        MSFT = as.timeSeries(data(msft.dat))[1:10, 1:4]
        head(MSFT)

     ## returnSeries -  
        # Continuous Returns:
        returns(MSFT)
        # Discrete Returns:
        returns(MSFT, type = "discrete")
        # Don't trim:
        returns(MSFT, trim = FALSE)
        # Use Percentage Values:
        returns(MSFT, percentage = TRUE, trim = FALSE)

