Newdata needs to be a dataframe with the same variable names as the
explanatory variables in your models.
Model <- lm(y ~ x, data = dataset)
Newdata <- data.frame(x = seq(from=0.1, to=0.32,by=0.02))
Newdata$y <- predict(Model, newdata = Newdata)
HTH,
Thierry
---
Dear Pat,
Have a look at recast from the reshape package.
library(reshape)
dataset <- expand.grid(factor1 = c("A", "B"), factor2 = c("C", "D"), Rep
= 1:3)
dataset$variable1 <- rnorm(nrow(dataset))
dataset$variable2 <- rnorm(nrow(dataset), mean = 10)
recast(factor1 + factor2 + variable ~ ., data =
Without your script we can't figure out what went wrong.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section bi
Dear Angela,
I think you have to omit the last lamba in the lmer code. Is there a
reason for putting it there?
lmer.lamda <- lmer(lamda ~ Age*Item + ( 1 | Subject), data=new4)
HTH,
Thierry
ir. Thierry Onkelinx
Insti
Dear Marlene,
Have a look at the polr() function in the MASS package.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Cel biometrie, methodologie
Dear Rainer,
You could have a look at ggsave() from the ggplot2 package. I guess that
such an approach to save a plot is easier to combine with a tool like
pdftk.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natu
You can't delete post for the mailing list. The posting guide reads:
"Posters should be aware that the R lists are public discussion lists
and anything you post will be archived and accessible via several
websites for many years."
Dear Noah,
You get Nan values because you devide by zero is all values are equal.
So it does not only happen when you have only zero's. Try scale(rep(1,
10))
A workaround is to turn the scaling off when all values are identical
(have zero variance). You can rearrange your nested loops with the
(u
Dear Paulo,
Your object is a named vector. Apply() and colMeans() only work on
matrices and dataframes. So you need to convert the vector to a matrix
or data.frame. See the example below. Please not that calculating the
mean of one element is a waiste of time.
# a named numerical vector
object <-
Dear Harry,
Your model seems rather complex. Do you have enough data to support it?
Did you check for multicollinearity between the variables?
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoe
Put your function in try() and the test it's class
gene.seq <- try(getSequence (id=gene.map[,"ensembl_transcript_id"],
type="ensembl_transcript_id", seqType="3utr", mart=hmart))
if(class(gene.seq) == "try-error"){
#code to run when an error occurs
} else {
#code to run when no er
Split the first column into two columns. One with the first letter and
one with the last letter. Then you cast() from the reshape-package to
create the matrix you want.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut vo
Dear Mo,
This is rather easy. Add an ID to each data series, rbind them into one
data.frame and use the colour argument of qplot.
data1 <- data.frame(corArms = rnorm(1000))
data2 <- data.frame(corArms = rnorm(3000, sd = 0.5))
data3 <- data.frame(corArms = rnorm(2000, sd = 2))
data1$ID <- "Data
s: 6 housing types, and I used five dummies
in model and one as the reference. I also tried to combine them into two
groups and use only dummy at random level, but it does not work either.
is there any one here has similar experience with the LME function in R?
Thanks.
Harry
On Tue, Aug 4, 20
2009 21:12
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: Re: [R] lme funcion in R
Thanks, Thierry and other R users.
I estimate the model using the factor rather than the dummy variables I
used previously. It still takes forever for the function "lme" to run.
But &quo
Dear Steve,
Multiplying the mean with the number of observations is essentially the same as
summing the numbers.
Have a look at the plyr packages.
library(plyr)
ddply(data, c("month", "year"), function(x){
c(MeanMultiplied = mean(x$ramm) * nrow(x), Sum = sum(x$ramm))
})
--
Dear all,
We are analysing some survey data and we are not sure if we are using
the correct syntax for our design.
The population of interest is a set of 4416 polygons with different
sizes ranging from 0.003 to 45.6 ha, 7460 ha in total. Each polygon has
a binary attribute (presence/absence) and
can be extracted from a given body of
data.
~ John Tukey
> -Oorspronkelijk bericht-
> Van: Thomas Lumley [mailto:tlum...@u.washington.edu]
> Verzonden: woensdag 7 april 2010 18:51
> Aan: ONKELINX, Thierry
> CC: r-help@r-project.org
> Onderwerp: Re: [R] Struggeling w
It can be done faster and more elegant with apply and rowSums
rows <- 10
A <- matrix(rpois(n = rows * 20, lambda = 100), nrow = rows)
A[4, c(1,3)] <- 1000
system.time({
y <- t(apply(A, 1, function(z){
1 * (z == max(z))
}))
y[rowSums(y) > 1, ] <- 0
})
s
Dear Matthew,
The easiest way the get the estimates (and their standard error) for the
different slopes it to reparametrise your model. Use resp ~ var1 : cat +
0 instead of resp ~ var1 * cat
HTH,
Thierry
ir. Thierry O
Dear Kay,
There is a R list about mixed models. Which is a better place for your
questions.
The (quasi)binomial family is used with binary data or a ratio that
originates from binary data. In case of a ratio you need to provide the
number of trials through the weights argument.
Further I would s
So your respons variable behaves like a continuous variable except that
is range is limited to the 0-1 interval. In such a case I would
transform the respons variable (e.g. logit, sqrt(arcsin())) and use a
gaussian model.
HTH,
Thierry
-
for(i in colnames(dummy)){
levels(dummy[, i]) <- abbreviate(levels(dummy[, i]))
}
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Gera
?cumsum can help you
m1 <- cbind(1:5,1:5,1:5)
m2 <- m1
for(i in 2:ncol(m1)){
m2[,i]=apply(m1[,1:i],1,sum)
}
m3 <- t(apply(m1, 1, cumsum))
all.equal(m2, m3)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut vo
Jan,
It looks like you did not understand the line "For a binomial GLM prior
weights are used to give the number of trials when the response is the
proportion of successes."
Weights must be a number of trials (hence integer). Not a proportion of
a population. Here is an example that clarifies the
ng 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: Jan van der Laan [mailto:djvanderl...@gmail.com]
> Verzonden: vrijdag 16 april 2010 16:09
> Aan: ONKELINX, Thierry
>
R is case sensitive. ecdf() is in the stats package, Ecdf() is in Hmisc.
So you want Ecdf(x,what='1-F')
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
95
Dear Nevil,
Converting your pdf to png will be the most efficient way to reduce the
file size with scatter plots.
You can either export directly to pdf or first create a pdf and then use
ghostscript to convert it into png. I tend to the the latter because it
is easier to get plots with a consiste
It looks like you are trying to mimic the SAS data step. In R you can
vectorise this.
a_data <- read.table("D:/SNP/copy.sas", header=T, sep="\t")
a_data$stat <- with(a_data, ifelse(truck < 0, 0, ifelse(cars > 100, 0,
cars)))
a_data$i <- seq_len(nrow(a_data))
outTable <- a_data[, c("i", "stat", "t
You are mixing data from two datasets with different lengths. Your x
variable has 51 elements, while the y variable has 306 elements? What
did you expect to happen with that?
Use only one dataset within a geom(). Otherwise you are likely the get
in troubles.
HTH,
Thierry
---
Dear Steve,
I don't think that ggplot2 has that option. Hadley, please correct me if
I'm wrong.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel
Dear Bryan,
In the ggplot() function you can choose between aes() and aes_string().
In the first you need to hardwire the variable names, in the latter you
can use objects which contain the variable names. So in your case you
need aes_string().
Unfortunatly, facet_grid() works like aes() and not
Dear Stephen,
It is much easier to do you data preparation before plotting.
Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name",
function(x){
x$Cummul <- cumsum(x$precipitation)
x
})
ggplot(Cummul, aes(x = date_time, y = Cummul)) + geom_line() +
facet_wrap(~gauge_name, s
You did not specify the random effects. Try something like
Rice.lme<-lme(Yield ~ Variety + Stand,data=Rice, random = ~1|Block)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Instit
Here is a solution using ggplot2
n <- 1000
dataset <- data.frame(A = rep(1:6, n), B = rep(gl(3, 2), n))
dataset$C <- with(dataset, rnorm(n) * as.numeric(B) + A)
library(ggplot2)
dataset$A <- factor(dataset$A)
#with default colours
ggplot(dataset, aes(x = A, y = C, colour = B)) + geom_boxplot()
#wi
Here is a solution using ggplot2
n <- 50
Duncan <- data.frame(income = runif(n, 0, 5))
Duncan$prestige <- with(Duncan, 0.01 * income - .001 * income ^2 +
rnorm(n, sd = 10))
library(ggplot2)
ggplot(Duncan, aes(y = prestige, x = income)) +
#define the data
geom_point() +
#ad
It's easy with the ggplot2 package
set.seed(1234)
dataset <- data.frame(x = seq(1,40,1))
dataset$Response <- with(dataset, 2*x+1+5*rnorm(length(x)))
library(ggplot2)
ggplot(dataset, aes(x = Response)) + geom_histogram(aes(y =
..density..)) + geom_density(colour = "red")
HTH,
Thierry
--
R 2.4.0 is obsolete. First update to the latest version (2.10.0, 2.10.1 will be
available soon). And then try to install the packages.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwalite
You have several options in R.
1) cast from the reshape package
cast(Factor1 + Factor2 ~ . , data = your.data.frame, value = "Value",
fun = mean)
2) ddply from the plyr package
ddply(your.data.frame, c("Factor1", "Factor2"),
function(x){mean(x$Value)})
HTH,
Thierry
-
Dear Pieter,
I suppose that you have attached your data.frame and then messed up the
Distance variable. Therefore do not use attach(your.data.frame) but use
the data = your.data.frame argument in your models.
If that does not solve the problem, then send us a reproducible example
of your problem
Dear Tom,
r_squared is a list of vectors and not a vector.
Use r_squared[[i]] instead of r_squared[i] or convert r_squared to a
vector with unlist(r_squared)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur-
Dear Stephen,
You need to print() the plot explicitly. This is FAQ 7.22
(http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis
-graphics-not-work_003f)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut vo
Dear Colm,
Use lm() instead of aov() and your problem is solved. The parameter of Group.L
is the linear trend along your groups. Group.Q the quandratic trend.
HTH,
Thierry
summary(lm(Mean_1 ~ Group*eventType, data=doi))
Call:
lm(formula = Mean_1 ~ Group * eventType, data = doi)
Residuals:
Baloo,
Why don't you use the built-in acf function?
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for
Just enter nlme:::ACF.gls at the command prompt and hit enter. This works with
most functions. Another option is to download the source code of nlme from CRAN.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur-
Dear Daniel,
Have a look at ?predict.lm The interval argument gives you the
information that you need.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverst
Please note that the case of characters is important in R. Hence "True"
differs from "TRUE". You need to use REML = TRUE instead of REML = True!
The only valid logical values are TRUE, FALSE, T and F. But I recommend
to use only TRUE and FALSE. Because you can overwrite T and F. You could
do somet
What device are you using to plot the graph? According to the warning,
the device is causing the problem.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Fo
Dear Andreas and Mike,
You need to use scale_colour_manual() if you want to set the colours yourself.
Ggplot2 interpretes the "col" variable in the dataset as an ordinairy factor.
library(ggplot2)
df0 <- data.frame(text = letters[1:21], tal1 = c(rnorm (20,5,2), 5), tal2 =
c(rnorm (20,6,3), 5))
an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
Van: Tena Sakai [mailto:tsa...@gallo.ucsf.edu]
Verzonden: donderdag 7 mei 2009 18:13
Aan: ONKELINX, Thierry; Ian Fellows; r-hel
Dear Christine,
The poisson family does not allow for overdispersion (nor
underdispersion). Try using the quasipoisson family instead.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Res
Dear Christine,
(Month|Block) and (1|Block) + (1|Month) are completely different random
effects. The first assumes that each Block exhibits a different linear trend
along Month. The latter assumes that each block has a random effect, each month
has a random effect and that the random effects of
Dear all,
I'm plotting some points on a graph where both axes need to have the
same scale. See the example below. Coord_equal does that trick but in
this case it wastes a lot of space on the y-axis. Setting the limits of
the y-axis myself was no avail.
Any suggestions to solve this problem?
l
key
-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Namens Dieter Menne
Verzonden: dinsdag 19 mei 2009 16:15
Aan: r-h...@stat.math.ethz.ch
Onderwerp: Re: [R] Coord_equal in ggplot2
ONKELINX, Thierry inbo.be> writes:
>
> I'm plotting some
Dear Tim,
Have a look at the ggplot2 package.
library(ggplot2)
ggplot(your.data.frame, aes(x = EducationYears, y = Income, colour =
Registered)) + geom_point()
You find a lot of examples at the ggplot2 website:
http://had.co.nz/ggplot2/
HTH,
Thierry
-
Dear David,
You would speed up things is you first create a subset were all values
of ldlc is >= 130. Then you only have to find the lowest age for each
child in this subset.
HTH,
Thierry
ir. Thierry Onkelinx
Institu
Dear Marlene,
Have a look at is.infinite(). Replacing them by zero is not a very
bright idea if you want the mean of the resulting vector. Have a look at
the example below.
#create a vector
x <- rnorm(100, mean = 1000)
#replace 20 values with Inf
x[sample(seq_along(x), 20, replace = FALSE)] <- In
Dear Girish,
As they are lattice plots, you need to print() them explicitly. It is
FAQ 7.22:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-
graphics-not-work_003f
<>=
print(plot(fm1, distance ~ fitted(.) | Subject, abline = c(0,1)))
@
Dear Jason,
Have a look at years() from the chron package.
library(chron)
HouseDates <- c("02/27/90", "02/27/91", "01/14/92", "02/28/93",
"02/01/94", "02/01/95", "02/01/96")
HouseDatesFormatted<-as.Date(HouseDates, "%m/%d/%y")
years(HouseDates)
HTH,
Thierry
Dear Malcom,
Another option is to merge both dataset to one big dataset and then plot
the big dataset.
d1 <- data.frame(a = c(rep(1:3, each = 3)), b = c(1:9), d = "A")
d2 <- data.frame(a = c(rep(1:3, each = 3)), b = c(9:1), d = "B")
Dataset <- rbind(d1, d2)
library(ggplot2)
Dataset$a <- factor(Da
Dear Titus,
Your first function can be simplified to
splice <- function(x, y) {
as.vector(rbind(x, y))
}
For factors, you better convert them first back to character strings.
splice <- function(x, y) {
x <- levels(x)[x]
y <- levels(y)[y]
factor(as.vector(rbind
Dear Marianne,
If find that a bit easier with ggplot() instead of qplot()
d1 <- data.frame(Goodall=c(rep(1:3,5)), Better.adapt =
c(rep(1,7),rep(2,8)),Second.adapt=c(rep(1:5,3)))
library(ggplot2)
ggplot(d1, aes(x= Goodall, y = Better.adapt, colour=Second.adapt)) +
geom_jitter(alpha = 0.2) + scale
Dear Damien,
I tend do use ggplot2 for more advanced plotting. You only have to
create a dataframe with all the data you need. Here are some examples.
library(gstat)
library(ggplot2)
data(meuse)
coordinates(meuse) = ~x+y
g1 <- gstat(id = "Raw", formula = lo
You need both the name of the dataframe and the variable in the
dataframe.
dfCorTFandPCA[order(dfCorTFandPCA$PC1)]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
You need to print() lattice plots inside a loop or a function.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Sect
Dear Anne,
Is age a continuous or a categorical variable? If it is a continuous
variable, then I would add it to the fixed effects.
You have two options for the random effect: (Fertilier|Family/Species)
or (1|Family/Species) + (0 + Fertilizer|Family/Species). Both yield a
random intercept and a r
Have a look at the examples in the helpfile for variogram from the gstat
package.
data(meuse)
# no trend:
coordinates(meuse) = ~x+y
variogram(log(zinc)~1, meuse)
# residual variogram w.r.t. a linear trend:
variogram(log(zinc)~x+y, meuse)
# directional variogram:
variogram(log(zinc)~x+y, meuse, alp
Dear Bernd,
Omitting the NA values from the dataset will work.
ggplot(aes(x = x, color = g), data = na.omit(mydf)) + geom_density()
Notice that I have omitted the group argument. It is redundant in this
case.
HTH,
Thierry
-
Hi Joris,
glm() handles proportions but will give you a warning (and not an error)
about non-integer values. So if you get an error then there should be
something wrong with the syntax, model or data. Can you provide us with
a reproducible example?
Cheers,
Thierry
-
can be extracted from a given body of
data.
~ John Tukey
-Oorspronkelijk bericht-
Van: Bernd Weiss [mailto:bernd.we...@uni-koeln.de]
Verzonden: woensdag 25 maart 2009 11:10
Aan: ONKELINX, Thierry; r-help@r-project.org
Onderwerp: Re: [R] [ggplot2] Densityplot, grouping and NAs
ONKELINX
Dear Evrim,
That is easy to do with the ggplot2 package. You only need the data in a
"long" format. melt() is very usefull to convert data from a wide to a
long format.
library(ggplot2)
n <- 100
Wide <- data.frame(X1 = rnorm(n, mean = -0.5), X2 = rnorm(n, mean = 0,
sd = 2), X3 = rnorm(n, mean = 0
Dear Dieter,
With t*treat the model allows for a different slope AND a different
intercept for each treatment. If you only want different slopes and all
intercepts equal to 0, then t:treat - 1 or t + t:treat - 1 is the model
you are looking for.
HTH,
Thierry
---
Dear Henning,
You need to print() lattice plots when using a device:
library(lattice)
pdf("plot1.pdf")
PLOT<-(xyplot, ...)
print(PLOT)
dev.off()
So this is not due to TINN-R.
HTH,
Thierry
ir. Thierry Onkelinx
Inst
Dear Melissa,
Use sapply instead of lapply and name the output vector of your Cusum
function. Note that I have simplified that function.
Cusum <- function(x){
SUM <- cumsum(x) - seq_along(x) * mean(x)
c(Min = min(SUM), Max = max(SUM), Diff = diff(range(SUM)))
}
lambs <- rnorm(10)
resamp
Dear Juliet,
ggsave uses 300 dpi as default and the png device 72 dpi. The problem
seems to be that everything is scaled properly except the pointsize. At
least on WinXP. A work around is to increase the theme base_size from 12
to 50 (12 * 300 / 72 = 50).
p <- p + theme_gray(50)
ggsave(file = "my
Dear Diederik,
If you revisited the same points then it makes sense to use the data at
the point level. But then I would mke that explicit by using a nested
random effect. In the nlme/lme4 syntax: 1|Site/Point. Make shure that
each point has a unique ID.
Naming a variable "count" is not a very go
Dear Lore,
The easiest thing to do is to write a function that saves your plot to a file
and generates the latex code.
<>=
pdf("fig1.pdf", width = wid, heigth = hei)
plot(1:10)
dev.off()
cat("\begin{figure}\")
cat("\includegraphics[width = ", wid, ", height = ", hei, "]{proj1-fig1}\"}
ca
Not of the self but still not complicated:
list1 <- data.frame(open=c(1,5), close=c(2,10))
list2 <- data.frame(open=c(1.5,3), close=c(2.5,10))
Intersec <- data.frame(Open = pmax(list1$open, list2$open), Close =
pmin(list1$close, list2$close))
Intersec[Intersec$Open > Intersec$Close, ] <- NA
Inter
Have a look at the width argument in ?options
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Sectio
can be extracted from a given body of data.
~ John Tukey
Van: Lore M [mailto:tchiba...@hotmail.com]
Verzonden: woensdag 15 april 2009 15:44
Aan: ONKELINX, Thierry; R Help
Onderwerp: RE: [R] using Sweave, how to save a plot in a given size
After few corrections
Dear karin,
Try rescaler from the reshape package:
install.packages("reshape")
library("reshape")
newDF <- apply(oldDF, 2, rescaler, type = "sd")
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderz
That is more or less FAQ 7.31:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-the
se-numbers-are-equal_003f
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nat
Dear all,
Could someone point me to a function or algorithm to generate random
bivariate binomial data?
Some details about what I'm trying to do. I have a dataset of trees who
were categorised as not damaged or damaged. Each tree is measured twice
(once in two consecutive years). The trees can r
Giuseppe,
Please enter a meaningfull subject line.
Have you tried the examples from the variogram helpfile? They clearly
demonstrate how to do it. If you still have problems, then you need to
give us a reproducible example of your dataset and code.
HTH,
Thierry
---
Dear Andreas,
melt() and cast() are nice tools for this kind of problems. They both
reside in the reshape package that automatic loaded when ggplot2 is.
a <- rnorm(100)
b <- rnorm(100,1,2)
c <- rnorm(100,2,0.5)
ds <- data.frame(a = a, b = b, c = c)
library(ggplot2) # loads qqplot2
ggplot(melt(ds)
: Charles C. Berry [mailto:cbe...@tajo.ucsd.edu]
Verzonden: vrijdag 17 april 2009 21:31
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: Re: [R] Generate bivariate binomial data
On Fri, 17 Apr 2009, ONKELINX, Thierry wrote:
> Dear all,
>
> Could someone point me to a function or alg
...@erasmusmc.nl]
Verzonden: woensdag 22 april 2009 11:48
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: Re: [R] Gee with nested desgin
Hi Thierry,
in geeglm() and in connection with the GEE theory, argument "id" should
identify the independent sample units in your data set, whi
Dear all,
Is it possible to incorporate a nested design in GEE? I have
measurements on trees that where measured in two years. The trees are
nested in plots. Each plot contains 24 trees. The number of plots is 72.
Hence we would expect 2 * 24 * 72 = 3456 data points. A few are missing,
so we end u
Dear Ben,
With a lot of overlapping errorbar things will always look cluttered.
Below you will find a few suggestions.
HTH,
Thierry
library(ggplot2)
nx <- 3
ngrp <- 5
nper <- 4
x <- rep(1:nx,ngrp*nper)
y <- runif(nx*ngrp*nper)
g <- factor(rep(1:ngrp,each=nx*nper))
dat <- data.frame(Year = fa
Dear Dimitri,
Have a look at melt() from the reshape package.
X<-matrix(c(10,20,30,40,50,60),2,3)
dimnames(X)<-list(c("1","2"),c("1","2","3"))
library(reshape)
melt(X)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut vo
Dear Chris,
Changing
coord_cartesian(ylim = c(0, 5))
into
coord_cartesian() + scale_y_continuous(limits = c(0, 5))
That should solve your problem.
HTH,
Thierry
ir. Thierry Onkelinx
Instit
Have a look at all.equal
matA <- matrix(1:4, ncol = 2)
matB <- matA
all.equal(matA, matB)
matB[1,1] <- -10
all.equal(matA, matB)
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research In
Have a look at ?save and ?load. Those function will allow you to save an
R object to a file and reload it when needed.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for
Dear Tommaso,
The residuals variance is fixed at 1 with the binomial family.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodol
Dear Christoph,
I done that and more. You'll find the functions below my signature. It
is mainly based on stepAIC from MASS. But it does more.
AICc = c(TRUE, FALSE) determines whether to use AICc or AIC
Furthermore it does not only refines the 'best' model but all good
models. A good model is de
Dear Vladimir,
You can use a logistic regression. First define Y0 as 30 - Y. Then Y is
the number of days with headache and Y0 the number of days without.
Then the model looks like: glm(cbind(Y, Y0) ~ X1 + X2 + X3, family =
"binomial")
HTH,
Thierry
I think you need
scale_fill_continuous("Your new label")
Note that you can simplify
scale_y_continuous(formatter = "percent") + ylab("Anteil in %")
To
scale_y_continuous("Anteil in %", formatter = "percent")
HTH,
Thierry
Jean-Baptiste,
You are not doing the same thing in R as in Stata. In stata you used the
probit link, in R the logit link.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwa
selection <- subset(somedf, col1 != "a")
sample(selection$col2, 2, replace = TRUE)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
glmer() nor lmer() work with the step function. You have to build your
models manually.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belg
101 - 200 of 618 matches
Mail list logo