Codificacion en r

Solo disponible en BuenasTareas
  • Páginas : 55 (13557 palabras )
  • Descarga(s) : 0
  • Publicado : 29 de febrero de 2012
Leer documento completo
Vista previa del texto
PRIMER PARCIAL

NATALIA MONTOYA MORENO
IVONNE BARRERA PUENTES
ANDREA MOYA

UNIVERSIDAD MILITAR NUEVA GRANADA
PROGRAMA INGENIERIA INDUSTRIAL
MERCADO DE CAPITALES
BOGOTA DC
2012

R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

R es un software libre y viene sin GARANTIA ALGUNA.Usted puede redistribuirlo bajo ciertas circunstancias.
Escriba 'license()' o 'licence()' para detalles de distribucion.

R es un proyecto colaborativo con muchos contribuyentes.
Escriba 'contributors()' para obtener más información y
'citation()' para saber cómo citar R o paquetes de R en publicaciones.

Escriba 'demo()' para demostraciones, 'help()' para el sistema on-line de ayuda,
o'help.start()' para abrir el sistema de ayuda HTML con su navegador.
Escriba 'q()' para salir de R.

[Previously saved workspace restored]

> library ("tseries")
Loading required package: quadprog
Loading required package: zoo

Attaching package: ‘zoo’

The following object(s) are masked from ‘package:base’:

as.Date, as.Date.numeric

‘tseries’ version: 0.10-28‘tseries’ is a package for time series analysis and computational
finance.

See ‘library(help="tseries")’ for details.

> library(moments)
> precio=get.hist.quote(instrument="tv",start="2000-01-01",quote="AdjClose")
probando la URL 'http://chart.yahoo.com/table.csv?s=tv&a=0&b=01&c=2000&d=1&e=22&f=2012&g=d&q=q&y=0&z=tv&x=.csv'
Content type 'text/csv' length unknown
URL abierta
downloaded 144Kb

time series starts 2000-01-03
> plot (precio)
> y=diff(log(precio))
> plot(y)
> mean(y)
[1] 0.0001324726
> sd(y)
AdjClose
0.02486234
Mensajes de aviso perdidos
sd() is deprecated.
Use apply(*, 2, sd) instead.
> skewness(y)
AdjClose
0.384453
> kurtosis(y)
AdjClose
9.433574
>
> mean (precio)
[1] 15.62281
> sd(precio)
AdjClose
6.222072
Mensajes de avisoperdidos
sd() is deprecated.
Use apply(*, 2, sd) instead.
> skewness(precio)
AdjClose
0.04532607
> kurtosis(precio)
AdjClose
1.80212
> pnorm(0,mean(y,sd(y))
+ )
[1] 0.4999985
Mensajes de aviso perdidos
sd() is deprecated.
Use apply(*, 2, sd) instead.
> rlnorm(1000,mean(precio),sd(precio))
[1] 1.113969e+10 1.709575e+08 3.841096e+07 2.608158e+03 6.532520e+07
[6]1.853728e+10 2.983049e+10 2.023623e+06 1.429602e+07 1.543529e+04
[11] 5.473181e+05 4.373574e+00 2.484549e+07 4.364447e+10 3.084910e+05
[16] 4.665483e+07 8.362928e-01 3.831429e+05 2.566855e+05 7.957306e+06
[21] 6.147697e+01 9.028773e+04 3.629684e+09 2.266317e+05 4.428097e+05
[26] 9.134691e+04 9.435065e+09 2.002481e+07 2.005854e+01 4.456158e+11
[31] 7.132862e+10 5.300587e+06 3.321067e+035.586798e+06 1.967559e+09
[36] 3.720131e+01 7.620819e+08 1.195292e+09 2.399649e+07 3.241190e+03
[41] 2.070860e+10 1.265529e+08 2.943609e+06 1.195332e+09 5.880753e+08
[46] 5.187704e+09 3.201780e+03 1.066480e+06 7.519602e+09 3.882915e+13
[51] 2.628907e+11 3.313139e+08 1.201772e+07 2.737251e+11 9.210591e+09
[56] 1.867816e+08 6.723468e+05 5.650688e+05 4.940908e-03 4.087347e+05
[61]9.509198e+03 2.997520e+03 1.591846e+07 1.618708e+07 2.283361e+09
[66] 3.752807e+04 1.102435e+07 2.181589e+07 1.945661e+10 2.445208e+05
[71] 1.526884e+10 8.071351e+07 8.489857e+05 6.386212e+12 3.262533e+04
[76] 1.127927e+08 6.614114e+06 4.100641e+09 3.417406e+08 3.690006e+02
[81] 1.592209e+09 3.028338e+03 2.802073e+04 5.365178e+01 8.948939e+04
[86] 7.393975e+05 1.730164e+03 3.145492e+072.927558e+03 2.590057e+06
[91] 2.244018e+11 2.885269e+05 2.102765e+07 1.692002e+07 2.600134e+12
[96] 2.742916e+09 8.186129e+11 3.816441e+07 7.177406e+03 6.371681e+06
[101] 1.039832e+08 3.972280e+08 3.387710e+03 9.453545e+03 1.411013e+05
[106] 2.141530e+02 3.133677e+07 5.887456e+09 5.373707e+07 7.134899e+04
[111] 3.109506e+04 1.620039e+03 6.093350e+07 5.927982e+03 1.749011e+08...
tracking img