How to use information on the stocks after applying moving averages:

http://courses.jmsc.hku.hk/jmsc7008spring2012/files/2010/02/MovingAverages.pdf

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages

Skip to content
#
Month / abril 2015

# Using moving average in investing

# Weighted Moving Average in R

# Advanced R, functionals in R

# When to Use a Particular Statistical Test

# Monte Carlo in R and Markov Chain Monte Carlo

# When to use chi square, fisher independence and Cochran–Mantel–Haenszel test for independence/association

# Explain relation between multiple regression, anova and t-test

# How To Calculate and Understand Analysis of Variance (ANOVA) F Test.

# t test and ANOVA similarities

How to use information on the stocks after applying moving averages:

http://courses.jmsc.hku.hk/jmsc7008spring2012/files/2010/02/MovingAverages.pdf

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages

This web presents a way to do weigthed moving average, extremely fast using Reduce:

http://quanttrader.info/public/FasterRCode.pdf

The code is:

lambda < 0.95

f < function(prv,nxt) {lambda*prv + (1lambda)*nxt }

ewma < Reduce(f,prices,accumulate=T)

Look at this doc:

http://www.csun.edu/~amarenco/Fcs%20682/When%20to%20use%20what%20test.pdf

Good to know when to use for example, Anova, t-test,….

The markovchain Package: A Package for Easily Handling Discrete Markov Chains in R

References about MC and MCMC:

MCMC:

Chi square and fisher independence are equivalent but use fisher exact test when the number of samples is small.

Both require the comparison of a result for at most two categorical data, being the result a numeric value. For example you can test if the presence or not of a gene influence the presence or not of a desease, that is, two categorical data with two possible values each. The categorical data can have more than two possible values but you can not have more than two categorical data (2 way contingency table). The null hypothesis is that there is no inluence due to the second categorical data on the distribution from the first.

An special case when you have 3 categorical data is the Cochran–Mantel–Haenszel test, in this test you test if the third categorical data represent an influence in the distribution of the 2×2 contingency table given by the other two variables. The third variable represents a repetition or strata.

Look at thsi pages for a good explanation:

http://www.biostathandbook.com/chiind.html

http://www.biostathandbook.com/fishers.html

http://www.biostathandbook.com/cmh.html

And this page, where is presented also the use of chi square test as a goodness of fit test:

http://wiener.math.csi.cuny.edu/Statistics/R/simpleR/stat013.html

Look at this explanation is great:

http://mathforum.org/library/drmath/view/56651.html

And this:

http://www.theanalysisfactor.com/why-anova-and-linear-regression-are-the-same-analysis/

This web is good comparing the techniques:

http://www.strath.ac.uk/aer/materials/4dataanalysisineducationalresearch/unit6/anovaandregression/

http://www.strath.ac.uk/aer/materials/4dataanalysisineducationalresearch/unit6/t-testsandanova/

I extracted this explanation from the above web about the results presented with ANOVA being general and not giving information about the particular group or groups that are different:

“One important thing to note about the F-test (in ANOVA) is that it is a **global test. What that means is that if we find a significant difference (p-value <.05) all we know is that overall there is a significant difference somewhere in the comparisons between the three groups. But, we don’t know where **exactly the significance lies.

It could be that the means of all three groups differ significantly from one another, or it could be that Finnish students differ from Scottish and Flemish students, or that Finnish students differ from Scottish student, but not from Flemish students, or another combination of differences my have led to the overall significant difference. Clearly, that is a bit frustrating, and we will want to find a way of telling us which countries are significantly different.”

I take also this explanation from :

http://www.allanalytics.com/author.asp?section_id=1413&doc_id=252823

“Regression and ANOVA always give exactly the same R^{2}, which measures the extent to which the variation in all the independent variables together explains the variation in the dependent variable (close to 0 percent means only random connection; close to 100 percent means the independent variables explain nearly everything). This is because ANOVA asks, “How much do differences in category make a difference in result?” and regression asks, “How much does category matter at all?” Both are forms of the same question.

Regression and ANOVA yield different F-statistics. The F-statistic is a ratio of variances from which a probability can be calculated that this situation is not the null hypothesis. (The null hypothesis is the hypothesis that the independent variables don’t matter.)

But the null hypothesis of regression and the null hypothesis of ANOVA are different.

Regression solves for the linear equation that minimizes the sum of the squared errors; for each dummy variable it assigns a coefficient, i.e. a number by which it is multiplied. Obviously, if a coefficient is zero, then the variable drops out of the equation and doesn’t have any effect at all. So for regression, the F-statistic tests how likely it is that the coefficient is not zero (against the null hypothesis that the coefficient is zero and there is no effect).

ANOVA uses the categories to split the overall population into sub-populations (what we call “segments” in marketing and “test groups” in industrial quality control), and then tests against the null hypothesis that the subpopulations all have the same average value of the dependent variable. The F-statistic tests the probability that the means differ only by chance.

That difference in the null hypothesis is a difference in the actual question the procedure answers. Just remember, regression asks, “Do the categories have an effect?” and ANOVA asks “Is the effect significantly different across categories?”

Look as well this videos: