Statistical theory _ Statistics

Source: Internet
Author: User
Tags cos sin
Hypothesis test distribution Test location test dispersion test Ansari-bradley

In Matlab, the Ansaribradley can be used for Ansari-bradley inspection. Bartlett ' s test

The Bartlett sphere (Bartlett's test) test is used to test false sets. It takes the correlation coefficient matrix of the variable as the starting point. Its 0 assumed correlation coefficient matrix is a unit array, that is, all elements on the diagonal of the correlation coefficient matrix are 1, and all non-diagonal elements are zero. The statistics of the Bartlett spherical test are derived from the determinant of the correlation coefficient matrix. If the value is large, and the corresponding companion probability value is less than the significant level of the user's heart, then we should reject the 0 hypothesis that the correlation coefficient cannot be the unit array, that is, the correlation between the original variables is suitable for the factor analysis.
The data expression for the Bartlett statistic test is:
χ2= (n−k) ln (S2p) −∑ki=1 (ni−1) ln (s2i) 1+13 (k−1) (∑ki=1 (1ni−1) −1n−k)
Among them, the size of K sample is NI, the sample variance is s2i; N=∑i=1kni, S2p=1n−k∑i (ni−1) s2i is the joint estimation of variance.
In MATLAB, the Barttest function is used to perform the Bartlett test.

Variance analysis

Variance Analysis (ANOVA) is based on the variance of observational variables, and studies the variables which have a significant effect on the observed variables in many control variables. Data dimensionality reduction

Feature transformation technology reduces the dimension of data by transforming the data to new features.
Feature selection techniques are more appropriate when variable transformations are not feasible (such as the classification variables in the data). Feature selection technique is especially suitable for least squares fitting. Factor analysis (Factor)

In MATLAB can use Factoran to carry on the factor analysis. Regression Algorithm Ridge regression

Ridge regression (English name: Ridge regression, Tikhonov regularization) is a biased estimation regression method specially used for collinearity data analysis, which is essentially an improved least squares estimation method, by giving up the unbiased of least squares to lose some information, To reduce the accuracy, the regression coefficients are more realistic and reliable, and the fitting of the pathological data is stronger than the least square method.
When the determinant of XTX is close to 0 o'clock, we add a number k to its main diagonal element, which can reduce the risk of XTX singularity greatly. So:
B (k) = (Xtx+ki) −1xty
With the increase of k, the absolute values of the elements bi (k) in B (k) tend to become smaller, and their deviations from the correct value bi are more and more large. When k tends to infinity, B (k) tends to be 0. B (k) The trajectory that changes with K is called the Ridge Trace. The actual calculation can choose a lot of k value, make a ridge map, see the figure in which value of the time to stabilize, then determine the K value.

Correlation analysis

The classical linear correlation analysis method is difficult to detect the structure and law of the data effectively, and it is paid more and more attention because it has the advantage of effectively characterizing the nonlinear correlation coefficient based on the measurement criterion of mutual information.
Consider a random variable X with n possible results whose probability distribution is P (x=xi) =pi,i=12,..., N. Then its information entropy is defined as H (X) =−∑i=1npilogpi.
Suppose that this joint probability of the stochastic variables (x,y) is Pij, the two-dimensional entropy of (x,y) is
H (x,y) =−∑i=1n∑j=1mpijlogpij
Suppose that the marginal distribution of X and Y repectively are pi and Pj˙, the conditional entropy X under the Condito N of kowning Y can be defined as
H (x/y) =−∑i=1n∑j=1mpijlogpijp⋅j
Similarity, the conditional entropy of Y under the conditon of kowning X can be defined as
H (y/x) =−∑i=1n∑j=1mpijlogpijpi⋅
Information theory holds that the more orderly the system is, the smaller the entropy is; conversely, the more chaotic the system, the greater the entropy of information. Therefore, information entropy can be used as the measure of uncertainty degree (or order degree) of system.

Maximum information coefficient

The traditional correlation coefficients of the maximum information coefficient (MIC) are often related to the measurement variables of specific function types (such as linear, exponential, periodic function), and the maximum information coefficient can measure the correlation of any function form, so the maximum information coefficient has generality For data of different function forms with equal maximum information coefficients, the maximum information coefficient is equal when the same noise is given and the maximum information coefficient is equal.
The mic can be computed using the Minepy package, which has MATLAB, Python, and R versions, which can be downloaded to its official web site.
The corresponding Python routine 1:

Import NumPy as NP
from minepy import MINE

def print_stats (MINE):
    print "MIC", Mine.mic ()


x = Np.linspace (0, 1, 1000)
y = Np.sin (Np.pi * x) + x
mine = Mine (alpha=0.6, c=15)
mine.compute_score (x, y)

print "Without noise:" 
  print_stats (mine)
print

np.random.seed (0)
y +=np.random.uniform ( -1, 1, x.shape[0]) # Add some noise
Mine.compute_score (x, y)

print "with noise:"
print_stats (mine)

Python routine 2:

From __future__ Import Division import numpy as NP import Matplotlib.pyplot as PLT from minepy import MINE def mysubplot (x, Y, NumRows, Numcols, Plotnum, xlim= ( -4, 4), ylim= ( -4, 4)): R = Np.around (Np.corrcoef (x, y) [0, 1], 1 ) mine = Mine (alpha=0.6, c=15) mine.compute_score (x, y) mic = Np.around (Mine.mic (), 1) ax = Plt.subplot (nu Mrows, Numcols, Plotnum, Xlim=xlim, Ylim=ylim) ax.set_title (' Pearson r=%.1f\nmic=%.1f '% (r, MIC) , fontsize=10) ax.set_frame_on (False) Ax.axes.get_xaxis (). Set_visible (False) Ax.axes.get_yaxis (). Set_visible (Fa LSE) Ax.plot (x, Y, ', ') ax.set_xticks ([]) ax.set_yticks ([]) return AX-def rotation (XY, T): return NP. Dot (xy, [[Np.cos (T),-np.sin (t)], [Np.sin (t), Np.cos (t)]] def mvnormal (n=1000): Cors = [1.0, 0.8, 0.4, 0.0, -0.4, -0.8, -1.0] for I, Cor in enumerate (cors): cov = [[1, Cor],[cor, 1]] xy = Np.rand Om.multivariate_normal ([0, 0], CoV, N) mysubplot (xy[:, 0], xy[:, 1], 3, 7, i+1) def rotnormal (n=1000): ts = [0, NP.PI/12, NP.PI/6, NP . Pi/4, NP.PI/2-NP.PI/6, NP.PI/2-NP.PI/12, NP.PI/2] cov = [[1, 1],[1, 1]] xy = Np.random.multivariate_nor Mal ([0, 0], CoV, n) for I, T in enumerate (ts): Xy_r = rotation (XY, T) Mysubplot (xy_r[:, 0], xy_r[:, 1] , 3, 7, I+8) def others (n=1000): x = Np.random.uniform ( -1, 1, n) y = 4* (x**2-0.5) **2 + np.random.uniform ( -1, 1, n )/3 Mysubplot (x, Y, 3, 7, ( -1, 1), ( -1/3, 1+1/3)) y = Np.random.uniform ( -1, 1, n) xy = np.concatenate (x.
    Reshape ( -1, 1), Y.reshape ( -1, 1)), Axis=1) xy = rotation (XY,-np.pi/8) Lim = Np.sqrt (2+np.sqrt (2))/NP.SQRT (2)
    Mysubplot (xy[:, 0], xy[:, 1], 3, 7, (-lim, Lim), (-lim, lim)) xy = rotation (XY,-np.pi/8) Lim = Np.sqrt (2) Mysubplot (xy[:, 0], xy[:, 1], 3, 7, (-lim, Lim), (-lim, lim)) y = 2*x**2 + np.random.uniform ( -1, 1, N) my Subplot (x, Y, 3, 7, 18,( -1, 1), ( -1, 3)) y = (x**2 + np.random.uniform (0, 0.5, n)) * \ np.array ([-1, 1]) [Np.random.random_integers (0 , 1, Size=n)] Mysubplot (x, Y, 3, 7,, ( -1.5, 1.5), ( -1.5, 1.5)) y = Np.cos (x * np.pi) + np.random.uniform (0, 1/

    8, N) x = np.sin (x * np.pi) + np.random.uniform (0, 1/8, N) mysubplot (x, Y, 3, 7, 20, (-1.5, 1.5), (-1.5, 1.5))  Xy1 = Np.random.multivariate_normal ([3, 3], [[1, 0], [0, 1]], int (N/4)) Xy2 = Np.random.multivariate_normal ([-3, 3], [[1, 0], [0, 1]], int (N/4)) Xy3 = Np.random.multivariate_normal ([ -3,-3], [[1, 0], [0, 1]], int (N/4)) Xy4 = Np.ra Ndom.multivariate_normal ([3,-3], [[1, 0], [0, 1]], int (N/4)) xy = Np.concatenate ((xy1, Xy2, Xy3, Xy4), axis=0) my Subplot (xy[:, 0], xy[:, 1], 3, 7, ( -7, 7), ( -7, 7)) Plt.figure (facecolor= ' white ') mvnormal (n=800) rotnormal (n=200) OT Hers (n=800) plt.tight_layout () plt.show ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.