## Probabilistic Utility

install.packages("mcmc")

> data(foo)
> out <- glm(y ~ x1 + x2 + x3, family = binomial, data = foo)
> summary(out)

Call:
glm(formula = y ~ x1 + x2 + x3, family = binomial, data = foo)

### Deviance Residuals:

Min       1Q   Median       3Q
-2.0371  -0.6337   0.2394   0.6685
Max
1.9599

Coefficients:
Estimate Std. Error z value
(Intercept)   0.5772     0.2766   2.087
x1            0.3362     0.4256   0.790
x2            0.8475     0.4701   1.803
x3            1.5143     0.4426   3.422
Pr(>|z|)
(Intercept) 0.036930 *
x1          0.429672
x2          0.071394 .
x3          0.000622 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’
0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 134.602  on 99  degrees of freedom
Residual deviance:  86.439  on 96  degrees of freedom
AIC: 94.439

#### Number of Fisher Scoring iterations: 5

> plot(out)
Hit <Return> to see next plot:
Hit <Return> to see next plot:

## How to analyze NSEI

getSymbols('^NSEI',src='yahoo')
[1] "NSEI"
Warning message:
^NSEI contains missing values. Some functions will not work if objects contain missing values in the middle of the series. Consider using na.omit(), na.approx(), na.fill(), etc to remove or replace them.
> barChart(NSEI)

Error in EMA(Cl(NSEI)) : Series contains non-leading NAs
> newEMA <- newTA(EMA, Cl, on=1, col=7)
> newEMA()
> newEMA(on=NA, col=5)

## The better way to analyze a stock

getSymbols('MSFT',src='yahoo')
[1] "MSFT"
> getSymbols('SBUX')
[1] "SBUX"
> barChart(SBUX)