MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Excel Data Managing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110368] Re: Excel Data Managing
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 15 Jun 2010 02:31:00 -0400 (EDT)

dateFromYear[dyr_?NumericQ] :=
 Module[{yr = IntegerPart[dyr]},
  DatePlus[{yr, 1, 1},
   FractionalPart[dyr]*
    DateDifference[
     {yr, 1, 1},
     {yr + 1, 1, 1}]]]

data = {
   {{"Year", "Price", "Dividend"}},
   {{1871., 77.2276, 4.52234}},
   {{1872., 83.2615, 4.51085}}, 
   {{2009., 888.75, 28.7598}}};

{year, price, dividend} =
  Rest /@ Transpose[Flatten[data, 1]];

ListLinePlot[Thread[{year, price}]]

DateListPlot[
 Thread[{
   dateFromYear /@ year,
   price}],
 Joined -> True]

FindFit[Thread[{year, price}],
 a + m*(yr - year[[1]]), {a, m}, yr]

{a->77.3042,m->5.88005}

ListLinePlot[Thread[{year, dividend}]]

DateListPlot[
 Thread[{
   dateFromYear /@ year,
   dividend}],
 Joined -> True]

FindFit[Thread[{year, dividend}],
 a + m*(yr - year[[1]]), {a, m}, yr]

{a->4.42878,m->0.176307}


Bob Hanlon

---- Sharing the Jazz <formenti.matteo at gmail.com> wrote: 

=============
Hi,
I import a dataset of three variable from excel to mathematica. The
input works but i don't know how to work on it, for example plot it,
analyze stationarity. The problem is that they are on this form and
Mathematica (with Time Series application) doesn't work.

{{{"Year", "Price", "Dividend"}}, {{1871., 77.2276,
   4.52234}}, {{1872., 83.2615, 4.51085}}, ..... {{2009., 888.75,
28.7598}}}

Can someone help me in start using this data?

Thank you very much,

Matteo
HEC-Paris



  • Prev by Date: Re: problem with the usage or implemetation of EllipticF[x,m] and
  • Next by Date: Re: Can you tell me what is wrong with this program
  • Previous by thread: Re: Excel Data Managing
  • Next by thread: Re: Excel Data Managing