[ndim,prob,chisquare] = barttest(x,alpha)also returns the significance values for the hypothesis testsprob, and theχ2values associated with the testschisquare.
Generate a 20-by-6 matrix of random numbers from a multivariate normal distribution with meanmu = [0 0]and covariancesigma = [1 0.99; 0.99 1].
rngdefault% for reproducibilitymu = [0 0]; sigma = [1 0.99; 0.99 1]; X = mvnrnd(mu,sigma,20);% columns 1 and 2X(:,3:4) = mvnrnd(mu,sigma,20);% columns 3 and 4X(:,5:6) = mvnrnd(mu,sigma,20);% columns 5 and 6
Determine the number of dimensions necessary to explain the nonrandom variation in data matrixX. Report the significance values for the hypothesis tests.
[ndim, prob] = barttest(X,0.05)
ndim = 3
prob =5×10.0000 0.0000 0.0000 0.5148 0.3370
The returned value ofndimindicates that three dimensions are necessary to explain the nonrandom variation inX.
Number of dimensions, returned as a positive integer value. The dimension is determined by a series of hypothesis tests. The test forndim = 1tests the hypothesis that the variances of the data values along each principal component are equal, the test forndim = 2tests the hypothesis that the variances along the second through last components are equal, and so on. The null hypothesis is that the number of dimensions is equal to the number of the largest unequal eigenvalues of the covariance matrix ofx.
prob— Significance value vector of scalar values in the range(0,1)
Significance value for the hypothesis tests, returned as a vector of scalar values in the range(0,1). Each element inprobcorresponds to an element ofchisquare.
chisquare— Test statistics vector of scalar values
测试统计数据为每个dimension’s hypothesis test, returned as a vector of scalar values.
Version History
Introduced before R2006a
예제 열기
이 예제의 수정된 버전이 있습니다. 사용자가 편집한 내용을 반영하여 이 예제를 여시겠습니까?
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.