Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 ?

share|improve this question
    
Not that I am aware of. Look here and here –  Sektor Jun 6 at 11:06
    
Not the same... –  Aleksandar Jun 6 at 11:23
    
I know it's not the same - I am giving you something to read. Plus, what is the reason behind the ban of Grid ? –  Sektor Jun 6 at 11:29
    
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.... –  Aleksandar Jun 6 at 11:33
add comment

1 Answer 1

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

share|improve this answer
    
Thank you very much! this is great!! –  Aleksandar Jun 6 at 13:11
    
Awesome answer. Thank you @kguler! –  Zet Jun 6 at 21:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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