mean of each column entry

5 ビュー (過去 30 日間)
Blazej Dobija
Blazej Dobija 2021 年 2 月 6 日
コメント済み: Cris LaPierre 2021 年 2 月 6 日
I have 2 arrays colA and colB, how can I get for example mean or other statistic of each entry of colB
I need to get something like this:
x = [-3084 -3085 -3086 -3087 etc]
y = [meanOfEachColB(-3084) meanOfEachColB(-3085) meanOfEachColB(-3086) meanOfEachColB(-3087) etc]
colA colB
+13884 -3084
+13884 -3082
+13864 -3084
+13892 -3086
+13848 -3084
+13776 -3086
+13940 -3085
+13792 -3085
+13856 -3084
+13908 -3082
+13888 -3086
+13884 -3085
+14004 -3086
+13860 -3084
+13860 -3082
+13856 -3082
+13860 -3083
+13840 -3085
+13908 -3083
+13772 -3084
+13764 -3085
+13920 -3085
+13904 -3086
+13944 -3085
+13900 -3086
+13912 -3086
+13852 -3086
+13964 -3087
+13944 -3083
+13908 -3085
+13848 -3085
+13860 -3083
+13984 -3084
+13936 -3086

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 2 月 6 日
I'd look into grpstats. See this example.
meanA = grpstats(colA,colB,'mean')
Another option is to use groupsummary. This might be helpful because it also returns the groups.
[meanA,grpB] = groupsummary(colA,colB,'mean')
  2 件のコメント
Blazej Dobija
Blazej Dobija 2021 年 2 月 6 日
編集済み: Blazej Dobija 2021 年 2 月 6 日
[meanA,grpB] = groupsummary(colA,colB,'mean')
this work great, thanks
PS. it there any similar function for "mean 95 confidence interval"?
Cris LaPierre
Cris LaPierre 2021 年 2 月 6 日
I'm not aware of a mean function in MATLAB that also returns a confidence interval. However, you can do this manually using the mean and standard deviation of each group. Perhaps this post can help you get started.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by