User Tools

Site Tools


repeated_measure_anova

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
repeated_measure_anova [2023/05/03 08:00] – [demo1] hkimscilrepeated_measure_anova [2024/05/08 08:16] – [demo 2] hkimscil
Line 79: Line 79:
  
 -- Picture about here -- -- Picture about here --
 +{{:pasted:20240501-082722.png}} 
 +---- 
 +{{:pasted:20240501-082738.png}} 
 +----
   * but, $\text{SS}_\text{{within}}$ can be partitioned as    * but, $\text{SS}_\text{{within}}$ can be partitioned as 
     * $\text{SS}_{\text{ subjects}}$ and $\text{SS}_{\text{ error}}$     * $\text{SS}_{\text{ subjects}}$ and $\text{SS}_{\text{ error}}$
Line 258: Line 261:
 see {{:r:repeated_measures_anova_eg.xlsx}} see {{:r:repeated_measures_anova_eg.xlsx}}
 ===== demo 2 ===== ===== demo 2 =====
-<code> +see [[:r:repeated measure anova]]
-# create data +
-df <- data.frame(patient=rep(1:5, each=4), +
-                 drug=rep(1:4, times=5), +
-                 response=c(30, 28, 16, 34, +
-                            14, 18, 10, 22, +
-                            24, 20, 18, 30, +
-                            38, 34, 20, 44, +
-                            26, 28, 14, 30)) +
- +
-# view data +
-df +
- +
-# within sujbect anova +
-within.aov.mod <- aov(response~drug+Error(patient), data=df) +
-</code> +
- +
-<code> +
-> #create data +
-> df <- data.frame(patient=rep(1:5, each=4), +
-+                  drug=rep(1:4, times=5), +
-+                  response=c(30, 28, 16, 34, +
-+                             14, 18, 10, 22, +
-+                             24, 20, 18, 30, +
-+                             38, 34, 20, 44, +
-+                             26, 28, 14, 30)) +
->  +
-> #view data +
-> df +
-   patient drug response +
-1        1    1       30 +
-2        1    2       28 +
-3        1    3       16 +
-4        1    4       34 +
-5        2    1       14 +
-6        2    2       18 +
-7        2    3       10 +
-8        2    4       22 +
-9        3    1       24 +
-10          2       20 +
-11          3       18 +
-12          4       30 +
-13          1       38 +
-14          2       34 +
-15          3       20 +
-16          4       44 +
-17          1       26 +
-18          2       28 +
-19          3       14 +
-20          4       30 +
->  +
-> #within sujbect anova +
-> within.aov.mod <- aov(response~drug+Error(patient), data=df) +
->  +
->  +
-> summary(within.aov.mod) +
- +
-Error: patient +
-          Df Sum Sq Mean Sq F value Pr(>F) +
-Residuals  1   67.6    67.6                +
- +
-Error: Within +
-          Df Sum Sq Mean Sq F value Pr(>F) +
-drug         11.6   11.56   0.139  0.714 +
-Residuals 17 1412.6   83.10  +
-</code> +
 ====== two way ====== ====== two way ======
 <code> <code>
repeated_measure_anova.txt · Last modified: 2024/05/13 08:39 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki