Table of Contents

1 Stats Intro

%Creating a probability distribution
m=linspace(-5,10,50);
Mu=2
Sigma=1.5
p=normpdf(m,Mu,Sigma)
plot(p)

%Creating a cumulative probability distribution
P=normcdf(m,Mu,Sigma)
plot(P)

%Random values from multivariate normal distribution
Mu=[0 0]
Sigma=[1  0; ...
       0  1];
[p]=mvnrand(Mu,Sigma)
p=mvnrnd(Mu,Sigma,10000);
plot(p(:,1),p(:,2),'+')

%Multivariate normal pdf
m=linspace(-5,5,50);
nM=length(m);
[M1,M2]=meshgrid(m);
p=mvnpdf([M1(:) M2(:)],Mu,Sigma);
p=reshape(p,nM,nM);

figure(938)
subplot(1,2,1)
imagesc(p)
axis square

subplot(1,2,2)
surf(p)
colormap summer

2 Statistics

2.1 Basic

zscore sampsizepwer

2.2 Hypothesis testing

2.2.1 chi-GOF

hypothesis: data fits a normal distribution (nothing known) Is a normal distribution a good model for my data to begin with?

chigof

2.2.2 z-test

ztest hypothesis: sample comes from a normal distribution known mean and variance

2.2.3 T-test

ttest hypothesis: sample comes from a normal distribution known mean

ttest2 hypothesis: two samples are normal and have same means (nothing known)

2.2.4 Non-normal (Wilcoxon)

signrank hypothesis: sample comes from some distribution known median

ranksum hypothesis: two samples have the same medians (nothing known)

2.2.5 Chi-var-test

vartest hypothesis: sample comes from a normal distribution known variance

2.2.6 F-test

vartest2 hypothesis: two samples have the same variance (nothing known)

vartestn: n samples

2.2.7 ANOVA

hypothesis: samples come from the same populations with same means hypothesis: differences between group1 and group2 have impact on observations

anova1 1 factor

anova2: 2 factor anovan: n factors

2.2.8 ANOCOVA

Just do regression

2.3 Correlation

corr xcorr xcorr2 xcorr2n cov partialcorr

2.4 Linear Regression

regress mvregress fitlm fitrlinear lasso ridge plsregress LinearModel

2.5 ANOVA

2.6 MLE

2.7 Machine learning

kmeans

Author: John Doe

Created: 2020-07-25 Sat 14:04