User Tools

Site Tools


pe:r-lang

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
pe:r-lang [2019/04/19 09:40]
218.186.146.102
pe:r-lang [2020/03/24 02:34] (current)
Line 5: Line 5:
   * Use the library   * Use the library
  
 +<code rsplus>
   library(tidyr)   library(tidyr)
   getwd()   getwd()
Line 19: Line 20:
      
   hist(vsltime$time, main="Anastomosis time (all) 2013-2014 n=512")   hist(vsltime$time, main="Anastomosis time (all) 2013-2014 n=512")
 +</code>
      
 {{:pe:vsl_success.png?200|}} {{:pe:vsl_success.png?200|}}
 +
 Histogram to check shape of distribution --> looks skewed to the right Histogram to check shape of distribution --> looks skewed to the right
  
 +<code rsplus>
   > shapiro.test(vsltime$time)   > shapiro.test(vsltime$time)
  
Line 29: Line 33:
   data:  vsltime$time   data:  vsltime$time
   W = 0.91157, p-value = 1.388e-14   W = 0.91157, p-value = 1.388e-14
 +
 +</code>
  
 Shapiro-Wilk test for normality --> not normal distribution Shapiro-Wilk test for normality --> not normal distribution
  
 +<code rsplus>
   > hist(vsl$success)   > hist(vsl$success)
 +</code>
      
 {{:pe:vsl_success.png?200|}} {{:pe:vsl_success.png?200|}}
  
 +<code rsplus>
   > shapiro.test(vsl$success)   > shapiro.test(vsl$success)
         Shapiro-Wilk normality test         Shapiro-Wilk normality test
   data:  vsl$success   data:  vsl$success
   W = 0.9117, p-value = 0.0002277   W = 0.9117, p-value = 0.0002277
-  +</code>   
 +Some other analyses: 
 + 
 +<code rsplus> 
 +  > plot(vsl$exp,vsl$rate,main="Anastomosis success rate vs experience (in years)"
 +  > plot(vsl$exp,vsl$totnum) 
 +  > plot(vsl$exp,((vsl$totnum/8)+(vsl$rate))/2) 
 +</code> 
 + 
 +{{:pe:successrate_number_vs_exp.png?400|}} 
 + 
 +Suggests that the first few years of experience does not seem to make a difference to performance, but many years of experience does (? self-selection or already some training). //Some form of correlation analysis might be helpful here.//   
 + 
 +===Spread=== 
 +<code rsplus> 
 +  > stem(((vsl$totnum/8)+(vsl$rate))/2) 
 + 
 +  The decimal point is 1 digit(s) to the left of the | 
 +   2 | 5 
 +   3 |  
 +   4 |  
 +   5 |  
 +   6 | 1333 
 +   7 | 1111111111112559999999999 
 +   8 | 1111177777888888888888888 
 +   9 | 44444444 
 +  10 | 0 
 + 
 +  > stem(vsl$rate) 
 + 
 +  The decimal point is 1 digit(s) to the left of the | 
 +   0 | 0 
 +   2 |  
 +   4 | 00007 
 +   6 | 07777771111155555 
 +   8 | 0000003333366666888 
 +  10 | 0000000000000000000000 
 +</code> 
 + 
 +See also [[r:20190423|Combined 13-14]] 
 + 
 +====Sources==== 
 +  * http://www.sthda.com/english/wiki/normality-test-in-r 
 +  * https://www.rdocumentation.org/packages/graphics/versions/3.5.3/topics/hist 
 +  * Using subset to drop columns: https://www.listendata.com/2015/06/r-keep-drop-columns-from-data-frame.html 
 +  * https://www.rdocumentation.org/packages/tidyr/versions/0.8.3/topics/unite 
 +  * http://www.r-tutor.com/r-introduction/data-frame/data-import 
 +  * https://www.rdocumentation.org/packages/tidyr/versions/0.8.3 
 +  * https://uc-r.github.io/tidyr
pe/r-lang.1555666848.txt.gz · Last modified: 2020/03/24 02:34 (external edit)