Sponsored Content
Full Discussion: Calculate Beta or Slope !
Top Forums Shell Programming and Scripting Calculate Beta or Slope ! Post 302707537 by csierra on Friday 28th of September 2012 10:55:30 PM
Old 09-28-2012
Question Calculate Beta or Slope !

Hello Group,

I would request your help to build a shell script that can calculate the beta or slope between a two series of investment instruments (i.e S&P 500 and Silver).
I have a source files of data (First - Date, Second (Value1) and Third (Value 2) columns)
Code:
Date    S&P 500    S&P 500    Silver    Silver
9/4/2012    140.28        31.36    
9/5/2012    140.16    -0.085616438    31.27    -0.287815798
9/6/2012    143.01    1.992867632    31.67    1.263024945
9/7/2012    143.56    0.383115074    32.64    2.971813725
9/10/2012    142.75    -0.567425569    32.29    -1.083926912
9/11/2012    143.15    0.279427174    32.41    0.370256094
9/12/2012    143.62    0.327252472    32.21    -0.620925179
9/13/2012    145.81    1.501954598    33.61    4.165426956
9/14/2012    146.46    0.443807183    33.6    -0.029761905
9/17/2012    145.96    -0.342559605    32.99    -1.849045165
9/18/2012    145.84    -0.082281953    33.71    2.135864729
9/19/2012    145.92    0.054824561    33.57    -0.417039023
9/20/2012    145.93    0.006852601    33.58    0.029779631
9/21/2012    145.87    -0.041132515    33.48    -0.298685783
9/24/2012    145.65    -0.151047031    32.93    -1.670209535
9/25/2012    144.1    -1.075641915    32.68    -0.76499388
9/26/2012    143.29    -0.56528718    32.87    0.578034682
9/27/2012    144.64    0.93335177    33.58    2.114353782
9/28/2012    143.97    -0.465374731    33.48    -0.298685783
                
        Slope or Beta        0.293057926


Attached you will find the spreadsheet of this example

Thanks in advance

Last edited by csierra; 09-29-2012 at 12:01 AM..
 

We Also Found This Discussion For You

1. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies
slagtm.f(3)							      LAPACK							       slagtm.f(3)

NAME
slagtm.f - SYNOPSIS
Functions/Subroutines subroutine slagtm (TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA, B, LDB) SLAGTM performs a matrix-matrix product of the form C = aAB+BC, where A is a tridiagonal matrix, B and C are rectangular matrices, and a and B are scalars, which may be 0, 1, or -1. Function/Subroutine Documentation subroutine slagtm (characterTRANS, integerN, integerNRHS, realALPHA, real, dimension( * )DL, real, dimension( * )D, real, dimension( * )DU, real, dimension( ldx, * )X, integerLDX, realBETA, real, dimension( ldb, * )B, integerLDB) SLAGTM performs a matrix-matrix product of the form C = aAB+BC, where A is a tridiagonal matrix, B and C are rectangular matrices, and a and B are scalars, which may be 0, 1, or -1. Purpose: SLAGTM performs a matrix-vector product of the form B := alpha * A * X + beta * B where A is a tridiagonal matrix of order N, B and X are N by NRHS matrices, and alpha and beta are real scalars, each of which may be 0., 1., or -1. Parameters: TRANS TRANS is CHARACTER*1 Specifies the operation applied to A. = 'N': No transpose, B := alpha * A * X + beta * B = 'T': Transpose, B := alpha * A'* X + beta * B = 'C': Conjugate transpose = Transpose N N is INTEGER The order of the matrix A. N >= 0. NRHS NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices X and B. ALPHA ALPHA is REAL The scalar alpha. ALPHA must be 0., 1., or -1.; otherwise, it is assumed to be 0. DL DL is REAL array, dimension (N-1) The (n-1) sub-diagonal elements of T. D D is REAL array, dimension (N) The diagonal elements of T. DU DU is REAL array, dimension (N-1) The (n-1) super-diagonal elements of T. X X is REAL array, dimension (LDX,NRHS) The N by NRHS matrix X. LDX LDX is INTEGER The leading dimension of the array X. LDX >= max(N,1). BETA BETA is REAL The scalar beta. BETA must be 0., 1., or -1.; otherwise, it is assumed to be 1. B B is REAL array, dimension (LDB,NRHS) On entry, the N by NRHS matrix B. On exit, B is overwritten by the matrix expression B := alpha * A * X + beta * B. LDB LDB is INTEGER The leading dimension of the array B. LDB >= max(N,1). Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: September 2012 Definition at line 145 of file slagtm.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 slagtm.f(3)
All times are GMT -4. The time now is 10:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy