[R] How to tell if there is overdispersion in a GLMM?

2015-02-03 Thread maggy yan
I read something on http://glmm.wikidot.com/faq, under "How can I deal with overdispersion in GLMMs?": library(lme4) ## 1.0-4set.seed(101) d <- data.frame(y=rpois(1000,lambda=3),x=runif(1000), f=factor(sample(1:10,size=1000,replace=TRUE))) m1 <- glmer(y~x+(1|f),data=d,family=poisson)

[R] how to melt variable to one variable

2013-11-23 Thread maggy yan
I want to make a stacked bar plot with one bar for two variables from my data "chir", the two variables have about 100 values like no, yes and na. I want to show how many no, yes and na they both have together with the stacked bar. I tried to melt these to variables first like this: melt1=melt(dat

[R] loops for matrices

2013-06-12 Thread maggy yan
I have to use a loop (while or for) to return the result of hadamard product. now it returns a matrix, but when I use is.matrix() to check, it returns FALSE, whats wrong? Matrix.mul <- function(A, B) { while(is.matrix(A) == FALSE | is.matrix(B) == FALSE ) {print("error") bre

[R] how to show a dataset in 3d?

2013-05-15 Thread maggy yan
my dataset looks like this in the beginning: Subject Time1 Time2 Time3 1 1 0.385 0.103 -0.488 2 2 -1.939 0.569 1.370 3 3 -1.196 -0.051 1.247 4 4 0.174 -1.163 0.989 5 5 1.246 0.558 -1.804 6 6 -1.108 -0.057 1.165 7 7 -0.609 -0.34

[R] dotcharts next to boxplots

2013-05-13 Thread maggy yan
my dataset looks like this in the beginning: Dosis weight sex 1 06.62 m 2 06.65 m 3 05.78 m 4 05.63 m 5 06.05 m 6 06.48 m 7 05.50 m 8 05.37 m 9 1

[R] need means on all boxplots, but only half of them got that

2013-05-11 Thread maggy yan
I tried to draw a point on all boxplots for their means, I did: boxplot( Daten$weight~interaction(Daten$Dosis,Daten$sex, drop=TRUE)) means<-tapply( Daten$weight, Daten$Dosis, mean) points(means, pch=5, col="red", lwd=5) but only the boxplots for male got that point on them, its really weird becau

[R] boxplot with grouped variables

2013-05-11 Thread maggy yan
my dataset looked like this in the beginning: >Daten V1 V2 V3 1 Dosis Gewicht Geschlecht 2 06.62 m 3 06.65 m 4 05.78 m 5 05.63 m I need box plots for V2 with all combination of V1 and V3, so I deleted the

[R] Central limit theorem

2011-08-14 Thread maggy yan
my data looks like this: PM10 Ref UZ JZ WT RH FT WR 1 10.973195 4.338874 nein Winter Dienstag ja nein West 26.381684 2.250446 nein SommerSonntag nein ja Süd 3 62.586512 66.304869 ja SommerSonntag nein nein Ost 45.590101 8.526152

[R] linear regression

2011-08-13 Thread maggy yan
dear R users, my data looks like this PM10 Ref UZ JZ WT RH FT WR 1 10.973195 4.338874 nein Winter Dienstag ja nein West 26.381684 2.250446 nein SommerSonntag nein ja Süd 3 62.586512 66.304869 ja SommerSonntag nein nein Ost 45.59010