Errors returned from skewness and kurtosis

9 ビュー (過去 30 日間)
yvette-hyq
yvette-hyq 2013 年 11 月 18 日
コメント済み: Steven Lord 2020 年 9 月 30 日
I am simply calculating four moments of a time series. But I have problem using skewness and kurtosis.
Following this example on the web http://www.mathworks.co.uk/help/stats/skewness.html, I simply copied X = randn([5 4]) and y = skewness(X) on to command window. Matlab returns:
"Error using nanmean Too many input arguments.
Error in skewness (line 39) x0 = x - repmat(nanmean(x,dim), tile);"
Can anyone tell me what is going wrong? Thanks a lot.
I don't want to change any source code before I am sure what is wrong. I think 'nanmean' works just fine itself.

回答 (2 件)

Sean de Wolski
Sean de Wolski 2013 年 11 月 18 日
It sounds like you have your own nanmean function shadowing the Statistics Toolbox' nanmean
which -all nanmean
Will show the offending file. Rename it to something else so that it does not conflict with Stats' nanmean.
  2 件のコメント
harshit Sapkal
harshit Sapkal 2020 年 9 月 30 日
'nanmean' not found.
I got this after running the command what should I do
Steven Lord
Steven Lord 2020 年 9 月 30 日
If you don't have nanmean installed you probably don't have Statistics and Machine Learning Toolbox installed. You can check that using the ver function. If you don't have this toolbox installed you also don't have the skewness and kurtosis functions as they're part of this toolbox as well.
But if you just want to take the mean of an array omitting NaN values you can call the mean function in MATLAB with the 'omitnan' option.

サインインしてコメントする。


yvette-hyq
yvette-hyq 2014 年 1 月 21 日
Thanks. Yes. There is another nanmean function in Dynare, the program package I used.

カテゴリ

Help Center および File ExchangeR Language についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by