welcome: please sign in
location: attachment:session4.r von RstatisTik/RstatisTikPortal/RcourSe/RcourseJune

Dateianhang 'session4.r'

Herunterladen

   1 ## load the data
   2 load("data/studrecords.rdata")
   3 
   4 ## Test the null hypothesis that the population mean math score
   5 ## is 500 against a two-sided alternative. Would you accept or
   6 ## reject at a 0.05 significance level?
   7 
   8 
   9 
  10 ## Test the null hypothesis that the mean math score is equal
  11 ## to the mean verbal (sat.v) score against a two sided hypothesis.
  12 
  13 
  14 
  15 ## Test the null hypothesis that the verbal and the math score
  16 ## is equal in each student.
  17 
  18 
  19 
  20 ## Wilcoxon signed-rank test
  21 pre.test <- c(17,12,20,12,20,21,23,10,15,17,18,18)
  22 post.test <- c(19,25,18,18,26,19,27,14,20,22,16,18)
  23 
  24 wilcox.test(pre.test,post.test,paired = T)
  25 
  26 ## exercises
  27 ## load the data frame normtemp from the file temperature.rdata;
  28 ## it contains the body temperature of several individuals,
  29 ## the gender and the heart rate
  30 
  31 
  32 ## test if the temperature is different in male (coded as 1)
  33 ## and female (coded as 2), use the appropriate test.
  34 
  35 
  36 ## test again, compare the results of the t test and the wilcoxon.
  37 
  38 
  39 
  40 ## plot the respective boxplots!
  41 
  42 
  43 
  44 
  45 
  46 ## add another layer
  47 ggplot(normtemp, aes(x = factor(gender), y = temperature)) +
  48     geom_boxplot() +
  49     geom_point()
  50 
  51 ggsave("boxplotpoint.png")
  52 
  53 
  54 ggplot(normtemp, aes(x = factor(gender), y = temperature)) +
  55     geom_boxplot() +
  56     geom_jitter()
  57 
  58 
  59 ggsave("boxplotjitter.png")
  60 
  61 
  62 ggplot(normtemp, aes(x = factor(gender), y = temperature)) +
  63     geom_boxplot() +
  64     geom_jitter(position=position_jitter(width=0.1))
  65 
  66 
  67 ggsave("boxplotjitter2.png")
  68 
  69 ggplot(normtemp, aes(x = factor(gender), y = temperature)) +
  70     geom_boxplot() +
  71     geom_point(stat = "summary", fun.y = "mean")
  72 
  73 ggsave("boxplotmean.png")
  74 
  75 
  76 ggplot(normtemp, aes(x = factor(gender), y = temperature)) +
  77     geom_boxplot() +
  78     geom_point(stat = "summary", fun.y = "mean",
  79                size = 5, colour = "red")
  80 
  81 ggsave("boxplotmean2.png")
  82 
  83 
  84 
  85 
  86 ## Exercises
  87 
  88 ## load the data set GaltonFamilies from the package HistData 
  89 
  90 
  91 ## make a boxplot of childHeight dependent on gender
  92 ## add the means using geom_point()
  93 
  94 
  95 
  96 
  97 
  98 ## do the respective t-test: what is the (trivial) null hypothesis,
  99 ## what is appropriate test, what is the test result and what is
 100 ## the conclusion?
 101 
 102 
 103 
 104 ## bivariate plots
 105 ggplot(GaltonFamilies, aes(x=mother,y=father)) +
 106     geom_point() 
 107 
 108 
 109 ggsave("scatter.png")
 110 
 111 
 112 ## adding a trend line
 113 ggplot(GaltonFamilies, aes(x=mother,y=father)) +
 114     geom_point() +
 115     geom_smooth()
 116 
 117 ggsave("scattertrend1.png")
 118 
 119 
 120 ## adding a trend line
 121 ggplot(GaltonFamilies, aes(x=mother,y=father)) +
 122     geom_point() +
 123     geom_smooth(method="lm")
 124 
 125 ggsave("scattertrend2.png")
 126 
 127 
 128 ## Exercises
 129 ## use again the GaltonFamilies data set; produce a scatter plot
 130 ## of childHeight vs midparentHeight
 131 
 132 
 133 
 134 
 135 
 136 ##add a trend line by using geom_smooth() without any
 137 ## arguments. Which method is used?
 138 
 139 
 140 
 141 
 142 
 143 ## add a second trend line, this time a linear one!
 144 
 145 
 146 
 147 
 148 
 149 
 150 ## now use the aesthetic colour in the first line of the plot
 151 ## definition. What happens?
 152 

Gespeicherte Dateianhänge

Um Dateianhänge in eine Seite einzufügen sollte unbedingt eine Angabe wie attachment:dateiname benutzt werden, wie sie auch in der folgenden Liste der Dateien erscheint. Es sollte niemals die URL des Verweises ("laden") kopiert werden, da sich diese jederzeit ändern kann und damit der Verweis auf die Datei brechen würde.
  • [laden | anzeigen] (2015-07-19 18:47:12, 6.9 KB) [[attachment:births.rdata]]
  • [laden | anzeigen] (2015-08-16 15:57:15, 5.2 KB) [[attachment:birthsweights.rdata]]
  • [laden | anzeigen] (2015-07-13 13:12:28, 1.1 KB) [[attachment:codebook.txt]]
  • [laden | anzeigen] (2015-10-11 17:34:48, 113.2 KB) [[attachment:dataglmm.zip]]
  • [laden | anzeigen] (2015-09-27 19:34:22, 1.1 KB) [[attachment:datamm.zip]]
  • [laden | anzeigen] (2015-09-21 12:37:51, 0.9 KB) [[attachment:datamod.zip]]
  • [laden | anzeigen] (2015-10-11 17:34:20, 1.9 KB) [[attachment:exercicesmm.r]]
  • [laden | anzeigen] (2015-07-12 16:50:25, 0.5 KB) [[attachment:exercise.r]]
  • [laden | anzeigen] (2015-07-19 18:48:54, 56.8 KB) [[attachment:exercises7mpi.pdf]]
  • [laden | anzeigen] (2015-07-20 12:55:14, 63.9 KB) [[attachment:exercises7rh.pdf]]
  • [laden | anzeigen] (2015-07-26 17:18:23, 95.0 KB) [[attachment:exercises8.pdf]]
  • [laden | anzeigen] (2015-10-12 12:47:51, 60.2 KB) [[attachment:exercisesglmms.pdf]]
  • [laden | anzeigen] (2015-10-11 17:35:38, 1.9 KB) [[attachment:exercisesmm.r]]
  • [laden | anzeigen] (2015-09-20 19:19:09, 62.8 KB) [[attachment:exercisesmod.pdf]]
  • [laden | anzeigen] (2015-10-04 13:16:42, 13.9 KB) [[attachment:gewichte.rdata]]
  • [laden | anzeigen] (2015-08-16 15:57:23, 2.5 KB) [[attachment:infection.rdata]]
  • [laden | anzeigen] (2015-07-12 16:51:18, 23.7 KB) [[attachment:material.zip]]
  • [laden | anzeigen] (2015-08-31 04:21:17, 12.9 KB) [[attachment:material11.zip]]
  • [laden | anzeigen] (2015-09-27 19:34:30, 0.9 KB) [[attachment:mm.r]]
  • [laden | anzeigen] (2015-07-26 17:19:27, 933.0 KB) [[attachment:nhanes1112.xlsx]]
  • [laden | anzeigen] (2015-06-07 16:16:59, 82.3 KB) [[attachment:pract2.pdf]]
  • [laden | anzeigen] (2015-08-16 15:57:03, 3.4 KB) [[attachment:session10exer.r]]
  • [laden | anzeigen] (2015-08-31 09:20:16, 1.7 KB) [[attachment:session11exer.r]]
  • [laden | anzeigen] (2015-06-05 13:09:58, 648.3 KB) [[attachment:session1gettinstarted.pdf]]
  • [laden | anzeigen] (2015-06-05 13:10:08, 178.8 KB) [[attachment:session1readdata.pdf]]
  • [laden | anzeigen] (2015-05-26 12:14:29, 145.4 KB) [[attachment:session1skriptdata.zip]]
  • [laden | anzeigen] (2015-06-07 16:19:51, 277.7 KB) [[attachment:session2.zip]]
  • [laden | anzeigen] (2015-06-14 15:30:31, 1.5 KB) [[attachment:session3.r]]
  • [laden | anzeigen] (2015-06-14 15:32:05, 2759.4 KB) [[attachment:session3.zip]]
  • [laden | anzeigen] (2015-06-21 17:18:54, 2.9 KB) [[attachment:session4.r]]
  • [laden | anzeigen] (2015-06-21 17:17:26, 4.1 KB) [[attachment:session4.zip]]
  • [laden | anzeigen] (2015-07-06 08:22:26, 2.6 KB) [[attachment:session5.r]]
  • [laden | anzeigen] (2015-07-12 16:47:47, 0.9 KB) [[attachment:session6.r]]
  • [laden | anzeigen] (2015-07-19 18:16:41, 0.9 KB) [[attachment:session7mpi.r]]
  • [laden | anzeigen] (2015-07-19 18:16:06, 2.1 KB) [[attachment:session7mpiexer.r]]
  • [laden | anzeigen] (2015-07-19 18:49:43, 1.9 KB) [[attachment:session7rhexerc.r]]
  • [laden | anzeigen] (2015-07-26 17:19:02, 0.8 KB) [[attachment:session8exer.r]]
  • [laden | anzeigen] (2015-08-02 16:54:59, 27.2 KB) [[attachment:session9data.xlsx]]
  • [laden | anzeigen] (2015-08-02 16:54:16, 4.0 KB) [[attachment:session9exer.r]]
  • [laden | anzeigen] (2015-09-27 19:34:47, 312.4 KB) [[attachment:sessionmm.pdf]]
  • [laden | anzeigen] (2015-10-04 13:16:17, 621.8 KB) [[attachment:sessionmm2.pdf]]
  • [laden | anzeigen] (2015-10-04 13:16:57, 0.8 KB) [[attachment:sessionmm2.r]]
  • [laden | anzeigen] (2015-07-09 09:26:13, 1.7 KB) [[attachment:skript2.r]]
  • [laden | anzeigen] (2015-07-09 09:25:51, 1.8 KB) [[attachment:skript3.r]]
  • [laden | anzeigen] (2015-07-09 09:25:33, 4.0 KB) [[attachment:skript4.r]]
  • [laden | anzeigen] (2015-07-09 09:25:21, 4.5 KB) [[attachment:skript5.r]]
  • [laden | anzeigen] (2015-08-16 15:56:40, 1057.3 KB) [[attachment:slides10.pdf]]
  • [laden | anzeigen] (2015-08-31 04:21:52, 697.3 KB) [[attachment:slides11.pdf]]
  • [laden | anzeigen] (2015-06-07 16:16:20, 340.9 KB) [[attachment:slides2.pdf]]
  • [laden | anzeigen] (2015-06-17 11:40:27, 225.9 KB) [[attachment:slides3.pdf]]
  • [laden | anzeigen] (2015-06-21 17:17:54, 651.2 KB) [[attachment:slides4.pdf]]
  • [laden | anzeigen] (2015-07-06 08:18:56, 587.8 KB) [[attachment:slides5.pdf]]
  • [laden | anzeigen] (2015-07-12 16:45:07, 256.4 KB) [[attachment:slides6.pdf]]
  • [laden | anzeigen] (2015-07-12 16:45:29, 266.2 KB) [[attachment:slides6a.pdf]]
  • [laden | anzeigen] (2015-07-19 15:47:33, 129.6 KB) [[attachment:slides7mpi.pdf]]
  • [laden | anzeigen] (2015-07-19 15:48:30, 740.6 KB) [[attachment:slides7rh.pdf]]
  • [laden | anzeigen] (2015-07-26 17:18:44, 545.8 KB) [[attachment:slides8.pdf]]
  • [laden | anzeigen] (2015-08-02 16:54:35, 573.2 KB) [[attachment:slides9.pdf]]
  • [laden | anzeigen] (2015-08-23 11:27:40, 121.1 KB) [[attachment:slidesMD.pdf]]
  • [laden | anzeigen] (2015-06-14 15:28:09, 1.7 KB) [[attachment:solutions.r]]
  • [laden | anzeigen] (2015-06-05 13:10:43, 1666.4 KB) [[attachment:userinterfaces.pdf]]
  • [laden | anzeigen] (2015-08-23 11:26:22, 212.7 KB) [[attachment:woodboring.pdf]]
  • [laden | anzeigen] (2015-06-07 16:17:19, 190.7 KB) [[attachment:wrapup.pdf]]
 Alle Dateien | Ausgewählte Dateien: löschen verschieben auf Seite copy to page

Sie dürfen keine Anhänge an diese Seite anhängen!