title: Mean, SD, ANOVA for repeated measures longitudinal
body: <p>Three Measurements (Time) are nested in Networkpartners (NP) which are nested in Persons (ID). The variable NP.T (created according to the answer mentioned <a href="https://stackoverflow.com/questions/18027823/creating-a-new-columns-from-a-data-frame">here</a>) indicates the number of Networkpartners (with no missing value on the Outcome) a specific person (ID) has on a specific measurement (1 to 3).  </p>
  
  <p>This is an example for my dataset, the real one has thousands of rows though.</p>
  
  <pre><code>   ID NP   Time Outcome  NP.T
  1   1 11    1       4    2
  2   1 12    1       2    2
  3   1 11    2       3    2
  4   1 12    2       3    2
  5   1 11    3      NA    1
  6   1 12    3       3    1
  7   2 21    1       2    2
  8   2 22    1       4    2
  9   2 21    2      NA    1
  10  2 22    2       4    1
  11  2 21    3      NA    1
  12  2 22    3       4    1
  </code></pre>
  
  <p>I want to calculate the following things and donot know how to do this properly:</p>
  
  <p>a) Mean, SD for the number of networkpartners at each measurement (NP.T). </p>
  
  <p>Also I'm interested in the number of Persons (IDs) that named at least one Networkpartner at each measurement.</p>
  
  <p>T1 -> 2 IDs named at least one Networkpartner</p>
  
  <p>T2 -> 2 IDs named at least one NP</p>
  
  <p>T3 -> 2 IDs named at least one NP</p>
  
  <p>It may sound trivial in this example, but it's not in my sample. for the computation of the means, sds ect. for each time i want to take into account only those IDs who actually named at least one networkpartner at that specific time. IDs who didn't name any NP at that specific time shouldn't be a part of the descriptive statistics for that time point.
  <strong>For clarification: If there is an NA on the output-variable it means, that that NP hadn't been named by it's ID at that timepoint.</strong></p>
  
  <p>b) reapeated measures ANOVA to find out if the mean number of networkpartners changes over the time</p>
  
  <p>some Expected Results:</p>
  
  <p>Mean.T1 = 2 &lt;- as both IDs had named two NPs at T1</p>
  
  <p>Mean.T2 = 1.5 &lt;- as one ID had named two and the other one NP at T2</p>
  
  <p>Mean.T3 = 1 &lt;- as both IDs had named one NP at T3</p>
  
  <p>n.T1 = 2</p>
  
  <p>n.T2 = 2</p>
  
  <p>n.T3 = 2</p>
  
  <p><strong>The problem is, that in the real dataset all persons named different amounts of Networkpartners, so i don't know how to calculate the descriptive statistics in this case.</strong> </p>