3
$\begingroup$

Does anyone know if there is an option or function that can automatically format the output of ANOVATable and ParameterTable, but without using the Grid function ?

$\endgroup$
4
  • $\begingroup$ Not that I am aware of. Look here and here $\endgroup$
    – Sektor
    Commented Jun 6, 2014 at 11:06
  • $\begingroup$ Not the same... $\endgroup$ Commented Jun 6, 2014 at 11:23
  • $\begingroup$ I know it's not the same - I am giving you something to read. Plus, what is the reason behind the ban of Grid ? $\endgroup$
    – Sektor
    Commented Jun 6, 2014 at 11:29
  • $\begingroup$ I read that already before posting the question thanks ;-) I have an assignment at uni.. Trying to figure out maybe a new algorithm or whatever.... $\endgroup$ Commented Jun 6, 2014 at 11:33

1 Answer 1

4
$\begingroup$

You can MapAt Style to specific Parts:

data = {{0, 1}, {1, 0}, {3, 2}, {5, 4}};
lm = LinearModelFit[data, x, x];

lm["ANOVATable"][[1, 1]]
(*{{"","DF","SS","MS","F\[Hyphen]Statistic","P\[Hyphen]Value"},
   {x,1,7.1228,7.1228,8.7552,0.09775},
   {"Error",2,1.6271,0.81355},
   {"Total",3,8.75}} *)

rowlabels = {1, 1, 2 ;;, 1};
collabels = {1, 1, 1, 1 ;;};
content = {1, 1, 2 ;;, 2 ;;};

MapAt[Style[#, Red, 20] &, lm["ANOVATable"], {rowlabels, collabels}] (* labels *)
MapAt[Style[#, Red, 20] &, lm["ANOVATable"], {content}]  (* all content *)
MapAt[Style[#, Red, 20] &, lm["ANOVATable"], {{1, 1, 2, 5}}]  (* a specific part *)

enter image description here

Replace "ANOVATable" above with "ParameterTable" to apply styles to ParameterTable.

Note that lm["ANOVATable"][[1, 1]] is a ragged array; so you need to make sure that you have the right indices when styling individual pieces.

On related note, to change the CellStyle of the output generated by lm["ANOVATable"], you can use something like

lm["ANOVATable"] /. "DialogStyle" -> "Subsection"

enter image description here

$\endgroup$
1
  • $\begingroup$ Awesome answer. Thank you @kguler! $\endgroup$
    – stathisk
    Commented Jun 6, 2014 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.