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
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)
All times are GMT -4. The time now is 01:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy