Dear Phil,
Have a look at the ggplot2 package.
library(ggplot2)
#classic boxplot
ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_boxplot()
#custom boxplot
myboxplot <- cast(cyl ~ ., value = "mpg", data = mtcars, fun = c(min, max, sd,
mean))
ggplot(myboxplot, aes(x = factor(cyl))) + geom_bo
Dear Luc,
IMHO a multinomial mixed model is appropriate for your data. It allows you to
model tree species with bird id and period as covariates. Have a look at the
vignette of the MCMCglmm package. You will find an example on hornets.
Best regards,
Thierry
PS R-sig-mixed models is a better l
Dear John,
You need to combine scale with a grouping function.
data(Orange)
library(plyr)
Orange <- ddply(Orange, .(Tree), function(x){
x$ddplyAge <- scale(x$age)[, 1]
x
})
Orange$aveAge <- ave(Orange$age, by = Orange$Tree, FUN = scale)
all.equal(Orange$ddplyAge, Orange$aveAge)
Dear William,
Please use a more informative subject line (as the posting guide asks you to
do).
Backslash have a special function. In file paths you need to use either double
backslashes or forward slashes.
'C:\\Users\\Bill\\Desktop\\DMwR_0.2.1.zip'
'C:/Users/Bill/Desktop/DMwR_0.2.1.zip'
Bes
You can vectorize it using cumsum.
cumsum(c(1, testvec))
all.equal(final.sum, cumsum(c(1, testvec)))
> -Oorspronkelijk bericht-
> Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> Namens Chris82
> Verzonden: woensdag 5 oktober 2011 11:50
> Aan: r-help@r-project.or
Eclipse with the Stat-ET plugin does syntax highlighting for .R, .Rd and .Rnw
files.
Best regards,
Thierry
> -Oorspronkelijk bericht-
> Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> Namens Joshua Wiley
> Verzonden: zondag 16 oktober 2011 22:09
> Aan: Bogaso C
Dear Iain,
RSiteSearch("ggplot2 reorder", restrict = c("Rhelp10", "Rhelp08")) gives you
the solution.
Best regards,
Thierry
> -Oorspronkelijk bericht-
> Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> Namens Iain Gallagher
> Verzonden: dinsdag 8 november 2011 1
Have a look at http://had.co.nz/ggplot2/stat_density.html You'll find some
exampled and the code to generate them.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniek
You want lme(logSSP~logM + K,random=~logM + K|species,data=data1)
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+
I find plogis() is easier to remember
all.equal(binomial()$linkinv(seq(-2, 2, length = 101)), plogis(seq(-2, 2,
length = 101)))
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assu
Dear Alex,
Have a look at the ggplot2 package
n <- 3502
junk <- list(list(matrix(rnorm(n), ncol = 1), matrix(rnorm(n, sd = 2), ncol =
1)), list(matrix(rnorm(n, mean = 1), ncol = 1), matrix(rnorm(n, mean = 1, sd =
2), ncol = 1)), list(matrix(rnorm(n, mean = 1), ncol = 1), matrix(rnorm(n, mean
=
Dear Tom,
R does not searches your entire file system for the file. It only looks in the
working directory. Have a look at ?setwd() and ?getwd()
So you will need to set the working directory, use a relative path to the file
or use and absolute path to the file.
Best regards,
ir. Thierry Onkel
f is a dataframe of factor, not a factor
use either
as.numeric(levels(f$your.factor))[f$your.factor]
or if f only contains factors
apply(f, 2, function(x){as.numeric(levels(x))[x]})
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Bio
Both specifications are the same model. An intercept is added by default unless
you use +0 or -1
like ~0 + LEAD|GRP or ~ -1 + LEAD|GRP
Van: r-help-boun...@r-project.org [r-help-boun...@r-project.org] namens YA
[xinxi...@163.com]
Verzonden: zaterdag 14 apri
This is discussed in the help of seq(). See the details section of ?sec
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderl
Dear Soren,
I would try adding the new variable to the dataset and use the data = argument
of lm
foo <- function(mod, data){
data$y3 <- c(1,3,3,4,6)
update(mod, y3 ~ ., data = data)
}
x <- 1:5
y <- c(1,2,3,3,6)
dataset <- data.frame(x = x, y = y)
mm <- lm(y~x, data = dataset)
foo(mm, datas
J,
For at least one combination of Aeventexhumed:HTL:Sector Shell is either 0 or
equal to TotalEggs.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Klinie
Hi Nameless,
You would have to add your code to the source of the ggplot2 package to make it
permanent. But that not a vary good idea.
Just add the line to your script and rerun it when you restart your analysis.
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research I
You could try something like this.
library(plyr)
ddply(pool, .(ym), function(z){
weighted.mean(x= z$SMM, w = z$wght)
})
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assur
This can be done without nested loops.
a <- expand.grid(rep(list(c(0,1)),7))
tmp <- apply(a, 1, function(x){
var(cumsum(x == 0)[x == 1])
})
a[is.na(tmp) | tmp == 0, ]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwalit
Try something like this
library(ggplot2)
data<-as.data.frame(cbind(a=c(1,1,2,2,2,2,3,3,4), b=c(1,2,3,3,4,4,4,4,4)))
library(reshape)
Molten <- melt(data)
ggplot(Molten, aes(x = value, colour = variable)) + geom_density()
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en boson
Dear Santos,
Since your models are nested you can apply a likelihood ratio test.
M0 <- glm(formula = Spend_bucket ~ Freq + Address_is_res +
last_update_days_ago, data = qdataset, family = binomial)
M1 <- glm(formula = Spend_bucket ~ Freq + Address_is_res, data = qdataset,
family = binomial)
ano
Have a look at this example
h1 <- cut(rnorm(1000, 4), breaks = seq(0, 8, by = 2))
h2 <- cut(rnorm(1000, 3), breaks = seq(0, 8, by = 2))
h3 <- cut(rnorm(1000, 5), breaks = seq(0, 8, by = 2))
dataset <- data.frame(Set = rep(c("A", "B", "C"), each = 100), value = c(h1,
h2, h3))
dataset$fvalue <- fac
>From the posting guide of this mailing list: Basic statistics and classroom
>homework: R-help is not intended for these.
Ask your fellow students or your teacher.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitsz
Dear Robert,
It is easier to use lm instead of aov if you want coefficients for each group.
Note that you can use rnorm vectorised.
set.seed(0)
N <- 100 # sample size
MEAN <- c(10, 20, 30, 40, 50)
VAR <- c(20,20,1, 20, 20)
LABELS <- factor(c("A", "B", "C", "D", "E"))
# create a data frame with
Dear nameless,
A mixed model seems reasonable for your kind of data. lme() from nlme or lmer()
from lme4 are good starting points.
Please note that there is R-sig-mixed-models: a R mailing list dedicated to
mixed models.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoe
You can achieve that with a combination of as.formula and paste.
library(nlme)
data(petrol, package = "MASS")
lme(as.formula(paste(Y.VAR, "~EP")), random= ~1|No, data=petrol)
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
F
You'll need to pass the data as a vector.
mean(16, 18) is asking the mean of 16. 18 is passed to the second argument
which is trim. So you are doing mean(16, trim = 18)
What you want is
mean(c(16, 18))
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Resear
offset() fixes the parameter to 1. So offset(I(.5*X2)) should do the trick.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2
Dear Alex,
I'm cc'ing this to the mixed models list which is more appropriate for the
question. Please send all follow up posts only to that list.
First a few more general remarks.
- You are using the data argument of glmmPQL. So there is no need to attach()
the data.frame. I recommend avoid to
Please give a reproducible example when making bold statements.
I find no evidence of autocorrelation in
set.seed(12345)
x <- rnorm(100, mean = 0, sd = 1)
acf(x)
x <- rnorm(1e6, mean = 0, sd = 1)
acf(x)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
That's because you have not specified the random effect. I think you want
lme(Error ~ Sequence + Temperature + Tumour, random = ~1|ID, data =
YourDataset)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en
Have you tried to merge the two datasets? See ?merge for the details.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en
Dylan,
You can write r sin(x + alfa) as a sin(x) + b cos(x). Then you just have
to fit a linear model. r = sqrt(a^2 + b^2) and tan(alfa) = b / a
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzo
Dear Felipe,
Is this what you want?
library(ggplot2)
mydata <- data.frame(PondName = factor(LETTERS[1:5]), avgWt = rnorm(5,
mean = 10, sd = 3))
ggplot(mydata, aes(x = PondName, y = avgWt)) + geom_bar()
ggplot(mydata, aes(x = PondName, y = avgWt, fill = PondName)) +
geom_bar()
HTH,
Thierry
--
Expand.grid works with lists too.
> expand.grid(rep(list(c("u", "l")), 3))
Var1 Var2 Var3
1uuu
2luu
3ulu
4llu
5uul
6lul
7ull
8lll
This is probably as concise as is can get.
HTH,
Thierry
--
If you would have tried
help.search("t-test")
It would have listed the function t.test()
?t.test
Will give you the helpfile with instructions.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderz
A solution with ggplot2 would be
dataset <- data.frame(cat = factor(rbinom(1000, 1, prob = .33), labels =
LETTERS[1:2]), startyear = floor(runif(1000, 2001, 2009)), studentid =
1:1000)
library(ggplot2)
ggplot(dataset, aes(x = startyear, colour = cat)) + stat_bin(aes(y =
..count..), geom="line", b
Try to set your own starting values. Use the values that you would expect for
S0, mu and sigma.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Cel
Use lapply on a costum function.
lapply(1:92, function(i){
(i - 1) * 2 + 1:2
})
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie,
RSiteSearch("Granger Causality", restrict = "functions") yields two
hits.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitsz
Emma,
It looks like there is at least one location that has been sampled at
least twice in some year. A co-worker of me got similar errors. After
checking his data carefully he found a duplicate row. Removing the
duplicate row solved his problem.
HTH,
Thierry
--
This is similar to FAQ 7.31. my is *printed* as 1, but in fact it is
slightly smaller. Try print(my, digits = 15). Rounding my works.
m<-matrix(nrow=10,ncol=10)
i<-1001
mx<-trunc(i/1000)
my<-round((i/1000-mx)*1000, 0)
m[mx, my]<-1
Thierry
---
Have you checked your data at row 3277? It could be that there is
something odd in that row.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biom
Try aggregate. It takes only 8 seconds for the 80 rows in the
example below.
m <- as.data.frame(matrix(rnorm(1600), ncol = 20))
m$ID <- rbinom(nrow(m), 10, prob = 0.5)
system.time(
aggregate(m[, 5:20], list(ID = m$ID), sd)
)
user system elapsed
6.141.377.55
>
HTH,
Th
Or str(summary(lm(..)))
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology
and qualit
Is this what you want?
dataset <- data.frame(x = c(rnorm(100), runif(100), rchisq(100, 1)), y =
gl(3, 100, labels = LETTERS[1:3]))
ggplot(dataset, aes(x = x, fill = y)) + geom_histogram()
ggplot(dataset, aes(x = x, fill = y)) + geom_histogram(position =
"dodge")
HTH,
Thierry
-
After reading your question again I came up with these plots.
dataset <- data.frame(x = c(rnorm(1000), rnorm(200, mean = 1)), y =
gl(2, 100, labels = LETTERS[1:2]))
ggplot(dataset, aes(x = x, group = y)) + stat_bin(aes(fill = ..count..),
width = 0.2) + scale_fill_gradient(low = "red", high = "gree
Dear Pedro,
Sorting your data before plotting it will probably sort your problem.
plotdata2 <- plotdata2[order(plotdata2$group), ]
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research I
Hi Pedro,
I think that the code below gives you the plot you want. Notice that you
don't have to add everthing seperatly. But you can if you feel the need
to do so.
ggplot(plotdata2, aes(x = x, y = y)) + geom_point() + facet_grid(group ~
.)
plot0 <- ggplot(plotdata2, aes(x = x, y = y))
layer1 <
Tribo,
It looks like geom_line() accepts only 4 linetypes and you asked for 5.
library(ggplot2)
Tree_v <- rep(c(1:5),each = 5)
age_v <- rep(seq(1,25, by = 5),5) + 10*runif(25)
circumference_v <- rep(seq(21,45, by = 5), 5)*Tree_v + 25*runif(25)
#This will work
Orange2 <- data.frame(Tree = as.fact
~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
-Oorspronkelijk bericht-
Van: Tribo Laboy [mailto:[EMAIL PROTECTED]
Verzonden: woensdag 26 maart 2008 17:42
Aan:
Dear Javier,
It seems to me that you want to calculate cross variograms. You can do
that with the gstat package. Have a look at the example in ?gstat
libary(gstat)
data(meuse)
# let's do some manual fitting of two direct variograms and a cross
variogram
g <- gstat(id = "ln.zinc", formula = log(zi
Dear Tom,
In my opinion you should first transform your data to the log-scale and then
calculate the mean and st.dev. of the log-transformed data. Because
mean(log(x)) is not equal to log(mean(x)).
HTH,
Thierry
ir.
Dear Balavelan,
First I would suggest to include the main effects of all variables in an
interaction. So you model with interaction should be y ~ a + b + c + d +
c:d. Which can be abbreviated to y ~ a + b + c*d.
Futhermore you should take a look at ?predict.glm and pay attention to
the newdata an
X[order(rownames(X)), ]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality
Dear João,
You can do permutation tests on an unbalanced design.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Cel biometrie, methodologie en kwa
Dear Anne-Katrin,
You could use ggplot to do this. The example below works, although it generates
some warnings.
library(ggplot2)
dataset <- data.frame(x = 0:55, y = rnorm(56, 10), z = runif(56, 9, 11))
ggplot(data = dataset) + geom_bar(aes(x = factor(x), y = y), position =
"dodge") + geom_line
Nicolas,
I think you better have a look at the gstat package.
install.packages("gstat")
library(gstat)
example(gstat)
?variogram
?krige
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Rese
Mikhail,
Have you tried sorting your dataframe according to the levels on the
x-axis?
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie
Berthold,
stepAIC does model selected based on AIC (or a similar criterion like
BIC). So it does not uses the alpha levels. Hence it's pointless to
specify them in stepAIC.
HTH,
Thierry
ir. Thierry Onkelinx
Instituu
Jorunn,
This solutions works with R 2.7.0 under windows
library(MASS)
library(nlme)
PredRes <- function(cal, val){
cal <<- cal
lmemod <- lme(distance ~ age * Sex, random = ~1|Subject, data = cal,
method="ML")
themod <- stepAIC(lmemod, dir="both", trace = FALSE)
prs <- predict(them
Dear Elke,
I think you need something like this. It's only for 3 variables, but I
think you know how to expand it for more variables.
mat <- expand.grid(a = 0:4, b = 0:4, c = 0:4)
write.table(mat, file="C:/Documents and Settings/My
Documents/permutations.txt",sep=";",col.names=FALSE, row.names=FA
Dear Bert,
Another option is to replicate SDF2 so the number of rows matches with those of
SDF1.
SDF1 <- data.frame(matrix(rnorm(144 * 2), nrow = 144))
SDF2 <- data.frame(matrix(rnorm(12 * 2), nrow = 12))
SDF1 / SDF2 #yields the error
SDF2a <- do.call(rbind, rep(list(SDF2), nrow(SDF1) / nrow(SD
Dear Julia,
You'll need to give more details on your model and the structure of your
dataset. The problem will probably be in the specification of the random
effects. But without the detail we can't check that.
Thierry
---
expand.grid() is what you are looking for.
expand.grid(x1, x2, x3)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kw
Have a look at scale_x_log10() and scale_y_log10() from the ggplot2
package. The helpfile with some examples is at
http://had.co.nz/ggplot2/scale_continuous.html
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natu
Dear Birgit,
You need to think about why you have that many NA's. In case of vegetation
data, it is very common to have only a few species present in a site. So how
would you record the abundance of a species that is absent? NA or 0 (zero)? One
could argument that it needs to be NA because you
You could try something like this (untested).
lapply(unique(elio2$id), function(i){
sub.mu <- exp.mu[exp.mu$id==i, ]
n <- nrow(sub.mu)
D <- matrix(0, n, n)
diag(D) <- sub.mu$deriv.link
A <- mat.cov[seq_len(n), seq_len(n)]
R <- corstr[seq_len(n), seq_len(n)]
SolveD <- solve(D)
Solv
Dear useRs,
I'm trying to specify the colour of a factor with ggplot2. The example
below gets me close to what I want, but it's missing a legend.
Any ideas?
Thanks,
Thierry
library(ggplot2)
dataset <- data.frame(x = rnorm(40), y = runif(40), z = gl(4, 10, labels
= LETTERS[1:4]))
ggplot(data =
~M.J.Moroney
-Oorspronkelijk bericht-
Van: Domenico Vistocco [mailto:[EMAIL PROTECTED]
Verzonden: maandag 3 december 2007 14:08
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: Re: [R] ggplot2: Choosing colours
qplot(data=dataset, x, y, colour=z)
ONKELINX, Thierry wrote:
> Dear us
icht-
Van: hadley wickham [mailto:[EMAIL PROTECTED]
Verzonden: maandag 3 december 2007 15:23
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: Re: [R] ggplot2: Choosing colours
Hi Thierry,
Have a look at http://had.co.nz/ggplot2/scale_identity. (The way you
are currently doing it only w
I think something like this would work.
Change your query to
rs <- dbSendQuery(con, statement = paste("select * from treatdata where
name='", whichDevice,"'", sep = ""))
And then create a script like.
whichDevice <- "Device1"
Sweave("myfile.rnw")
whichDevice <- "Device2"
Sweave("myfile.rnw")
Pedro,
I've had a similar problem. See this post for the solution:
http://thread.gmane.org/gmane.comp.lang.r.general/100649/focus=100673
Cheers,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek /
Felipe,
You'll need to define the limits yourself with scale_y_continuous.
library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y=mpg)) + geom_point()
p + geom_hline(intercept=0) + scale_y_continuous(limits = c(0, max(mtcars$mpg)))
Cheers,
Thierry
Van: [EMAIL P
Dan,
You could write a function that just creates the data. And call this
function each time you need the data.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
a <- list(one=matrix(rnorm(20), 5, 4), two=matrix(rnorm(20, 3,
0.5),5,4))
lapply(a, function(x){
cbind(x, rowSums(x))
})
Cheers,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Insti
Dear Francesc,
This is rather easy to do with the ggplot2 package.
library(ggplot2)
dataset <- expand.grid(x = 1:10, y = 1:50)
dataset$z <- runif(nrow(dataset))
ggplot(data = dataset, aes(x = x, y = y, fill = z)) + geom_tile() +
scale_fill_gradient(low="white", high="black") + coord_equal()
Hav
Dear David,
Try this solution. The data are stored is a dataframe instead of a list
but they should be the same. Once you have this dataframe, thinks get
rather easy.
library(ggplot2)
a <- seq(0, 360, 5)*pi/180
s <- seq(5, 45, 10)*pi/180
dataset <- expand.grid(a = a, s = s)
d
Javier,
You can use two lm-models for that. One for each coordinate. Then use
predict() to calculate the coordinates of the other points. And by the
way: four points is not very much data to calculate a transformation. I
mlight work if the image is not very much distorted and you have precise
meas
Grant,
Have you considered a gls model instead of a lm model? In a gls model
one can model the correlation between the measures. So you won't need to
select a subset of your data. You can kind gls in the nlme package.
HTH,
Thierry
---
Dear Matthew,
First of all I'm forwarding this to R-SIG-Mixed, which is a more
appropriate list for your question.
Using a mixed effect with only 5 levels is a borderline situation.
Douglas Bates recommends at least 6 levels in order to get a more or
less reliable estimate. So I would consider the
Dear Erich,
Have a look at ggplot2
library(ggplot2)
dataset <- expand.grid(x = 1:20, y = factor(LETTERS[1:4]), value = 1:10)
dataset$value <- rnorm(nrow(dataset), sd = 0.5) + as.numeric(dataset$y)
plotdata <- aggregate(dataset$value, list(x = dataset$x, y = dataset$y),
mean)
plotdata <- merge(plo
Something like this?
do.call("rbind",
lapply(
split(Dataf, Dataf$id),
function(x){
x[sample(seq_len(nrow(x)), size=2), ]
}
)
)
HTH,
Thierry
Steve,
Have a look at the ggplot2 package:
library(ggplot2)
ggplot(Jan, aes(x = PopDensity, y = Average.Burnt.Area.Fraction, colour
= factor(Urban.Rural > 1.25))) + geom_point()
ir. Thierry Onkelinx
Instituut voor na
First of all I'm forwarding this mail to the R-SIG-mixed-models, which
is more appropriate to your question.
Remember that family = bionomial uses by default the logit link. Hence
all parameters will be on the logit scale. So you will need to
backtransform them for comparison. Then you'll see tha
John Tukey
-Oorspronkelijk bericht-
Van: Steve Murray [mailto:[EMAIL PROTECTED]
Verzonden: donderdag 18 september 2008 19:08
Aan: r-help@r-project.org; ONKELINX, Thierry; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Onderwerp: RE: [R] Use of colour in plots
Dear Thierry and all,
I've t
:[EMAIL PROTECTED]
Verzonden: vrijdag 19 september 2008 16:01
Aan: ONKELINX, Thierry; r-help@r-project.org
Onderwerp: RE: [R] Use of colour in plots
Sorry - I should've maybe also pointed out that the command I've been
trying to use is: alpha(col="green", 1/10)
On its own this res
Dear Michael,
Try ggplot2. Use something like
install.packages("ggplot2")
library(ggplot2)
recov <- 0:2
n <- 1000
all <- data.frame(bbED = rnorm(3 * n, mean = recov), recov =
factor(rep(recov, n)))
ggplot(data = all, aes(x = bbED)) + geom_histogram() + facet_grid(. ~
recov)
ggplot(data = all, aes
a, varnames) :
> Formula contains variables not in list of known variables
>
> How can I select cases?
>
> Any ideas or suggestions?
> Thanks,
> M Just
>
> On Thu, Oct 2, 2008 at 2:42 AM, ONKELINX, Thierry <
> [EMAIL PROTECTED]> wrote:
>
>> Dear M
ohn Tukey
Van: Michael Just [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 3 oktober 2008 6:52
Aan: ONKELINX, Thierry
CC: r-help@r-project.org; [EMAIL PROTECTED]
Onderwerp: Re: [R] Multiple hist(ograms) - One plot
Dieter and Thierry:
Per you suggestions I have tried:
ggp
Dear Erich,
Have a look at the try()-function.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Sect
Another solution would be
faclevels<-c("Not","Little","Somewhat","Very", NA)
group <- factor(1:6)
svdf<-data.frame(value = sample(group, 400, TRUE), category =
sample(faclevels,400,TRUE))
library(ggplot2)
ggplot(svdf, aes(x = value, fill = category)) + geom_histogram(position
= "dodge")
HTH,
Thi
Dear Stephen,
You need the data in long format. Try melt()ing it first.
River.Mile <-c(202, 198, 190, 185, 179, 148, 119, 61)
TSS <- c(1:8)
DOC <- seq(2, by= 0.6, length.out=8)
z <- data.frame(River.Mile, TSS, DOC)
zMelt <- melt.data.frame(z, id.vars = "River.Mile")
library(ggplot2)
ggplot(zMelt,
Dear Katrin,
Store the "old" data in a dataframe instead of vectors and supply the
name of that dataframe to your model. eg
Model <- glm(species ~ temp + prec + elev, data = your.data.frame,
family = binomial(link = logit))
Notice that I've added some spaces which makes your code more easy to
r
Dear all,
Is there an elegant way to add citations of packages when using Sweave?
Ideally I'd like a function which creates a Bibtex-file with the
packagenames as keys. The idea is to use \cite{packagename} or \cite{R}
in LaTeX.
I know you can get the Bibtex entry with
toBibtex(citation("packagen
. Berry [mailto:[EMAIL PROTECTED]
Verzonden: donderdag 23 oktober 2008 18:54
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: Re: [R] Automating citations in Sweave
On Thu, 23 Oct 2008, ONKELINX, Thierry wrote:
> Dear all,
>
> Is there an elegant way to add citations of packages w
or an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
-Oorspronkelijk bericht-
Van: Achim Zeileis [mailto:achim.zeil...@wu-wien.ac.at]
Verzonden: dinsdag 16 december 2008 16:45
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: R
Dear Luciano,
The "1" in (1|NestID) indicates only a random intercept. Note that in
most models in R, a "1" on the righthandside of the formula indicates
the intercept, "-1" or "0" indicates no intercept. ~X, which is
equivalent to ~X + 1, indicates a slope along X and an intercept. Hence
a random
Are you sure that you have all your packages updated? Because qplot(mpg, wt,
data=mtcars) works without a problem on my machine. Please add the info of
sessionInfo() when reporting bugs. The posting guide asked you to do so.
Thierry
>sessionInfo()
R version 2.8.0 (2008-10-20)
i386-pc-mingw32
401 - 500 of 618 matches
Mail list logo