W statistic given in (7) of GRS (1989) <DOI:10.2307/1913625>
1  GRS.MLtest(ret.mat, factor.mat)

ret.mat 
portfolio return matrix, T by N 
factor.mat 
matrix of risk factors, T by K 
T: sample size, N: number of portfolio returns, K: number of risk factors
GRS.stat 
GRS test statistic 
GRS.pval 
its pvalue 
theta 
maximum Sharpe ratio of the K factor portfolios 
thetas 
slope of the efficient frontier based on all assets 
ratio 
theta/thetas, proportion of the potential efficiency 
Applicable to CAPM as well as a multifactor model
Jae H. Kim
Gibbons, Ross, Shanken, 1989. A test of the efficiency of a given portfolio, Econometrica, 57,11211152. <DOI:10.2307/1913625>
Fama and French, 1993, Common risk factors in the returns on stocks and bonds, Journal of Financial Economics, 33, 356. <DOI:10.1016/0304405X(93)900235>
Fama and French, 2015, A fivefactor assetpricing model, Journal of Financial Economics, 116122. <DOI:http://dx.doi.org/10.1016/j.jfineco.2014.10.010>
1 2 3 4 
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.