[R] [nlme] How to calculate standard error of random effects in lme

2011-10-07 Thread Marcus Drescher
Hi all,

is there a way to calculate standard error of random effect from the estimated 
model in lme?

Best
Marcus

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Lattice: xyplot group title format

2010-11-09 Thread Marcus Drescher
Dear all,

if I plot a lattice xyplot like:

library(lattice); require(stats);
Depth <- equal.count(quakes$depth, number=8, overlap=.1)

xyplot(lat ~ long | Depth, data = quakes)


How can I manipulate the group title format (here: Depth)? Like the font size, 
position, etc.

Best
Marcus 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Several lattice plots on one page

2010-11-08 Thread Marcus Drescher
Dear all,

I am trying (!!!) to generate pdfs that have 8 plots on one page:


df = data.frame(
day = c(1,2,3,4),
var1 = c(1,2,3,4),
var2 = c(100,200,300,4000),
var3 = c(10,20,300,4),
var4 = c(10,2,3,4000),
var5 = c(10,20,30,40),
var6 = c(0.001,0.002,0.003,0.004),
var7 = c(123,223,123,412),
var8 = c(213,123,234,435),
all = as.factor(c(1,1,1,1)))

pdf("test1.pdf", width=20, heigh=27, paper="a4") 
print(plot(groupedData(var1 ~ day | all, data = df), main = "var1", 
xlab="", ylab=""), split=c(1,1,2,4), more=TRUE)
print(plot(groupedData(var2 ~ day | all, data = df), main = "var2", 
xlab="", ylab=""), split=c(1,2,2,4), more=TRUE)
print(plot(groupedData(var3 ~ day | all, data = df), main = "var3", 
xlab="", ylab=""), split=c(1,3,2,4), more=TRUE)
print(plot(groupedData(var4 ~ day | all, data = df), main = "var4", 
xlab="", ylab=""), split=c(1,4,2,4), more=TRUE)
print(plot(groupedData(var5 ~ day | all, data = df), main = "var5", 
xlab="", ylab=""), split=c(2,1,2,4), more=TRUE)
print(plot(groupedData(var6 ~ day | all, data = df), main = "var6", 
xlab="", ylab=""), split=c(2,2,2,4), more=TRUE)
print(plot(groupedData(var7 ~ day | all, data = df), main = "var7", 
xlab="", ylab=""), split=c(2,3,2,4), more=TRUE)
print(plot(groupedData(var8 ~ day | all, data = df), main = "var8", 
xlab="", ylab=""), split=c(2,4,2,4))
dev.off()


My problem is that the separate plots all have different sizes. (Some are tall, 
but very small, or the other way around. The target is to have equally tall and 
wide graphs. (The variables have different scales. Grouping does not work.)

Optimally, the plots would use the complete pdf page.

Any ideas how to adjust height and width?

Best 
Marcus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread Marcus Drescher
I am sorry for the typo, it is about counting two columns an skipping the NAs.

How would I have to set the formula if I would have two columns to count (val1 
and val2)?


Betreff: Re: [R] Count values in a dataframe with respect to groups

Try this:

aggregate(val ~ grp, dta, length)

On Fri, Oct 8, 2010 at 11:28 AM, Marcus Drescher  wrote:
Dear all,

I am looking for a function to count values belonging to a class within a 
dataframe (and ignore NAs).

grp = c(1,1,1, 1,2, 2,2)
val = c(2,1,5,NA,3,NA,1)

dta = data.frame(grp=grp, val=val)

The result should look like:

grp count
 1    3
 2    2

At the moment, I am trying to find a function for FUN in aggregate, but with no 
success. Can anybody help me?

Thanks in advance.
Marcus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread Marcus Drescher
Thanks! It works great.

One more question: how would I have to set the formula if I would have the 
columns to count (val1 and val2)?


Betreff: Re: [R] Count values in a dataframe with respect to groups

Try this:

aggregate(val ~ grp, dta, length)

On Fri, Oct 8, 2010 at 11:28 AM, Marcus Drescher  wrote:
Dear all,

I am looking for a function to count values belonging to a class within a 
dataframe (and ignore NAs).

grp = c(1,1,1, 1,2, 2,2)
val = c(2,1,5,NA,3,NA,1)

dta = data.frame(grp=grp, val=val)

The result should look like:

grp count
 1    3
 2    2

At the moment, I am trying to find a function for FUN in aggregate, but with no 
success. Can anybody help me?

Thanks in advance.
Marcus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Count values in a dataframe with respect to groups

2010-10-08 Thread Marcus Drescher
Dear all,

I am looking for a function to count values belonging to a class within a 
dataframe (and ignore NAs).

grp = c(1,1,1, 1,2, 2,2)
val = c(2,1,5,NA,3,NA,1)

dta = data.frame(grp=grp, val=val)

The result should look like:

grp count
 13
 22

At the moment, I am trying to find a function for FUN in aggregate, but with no 
success. Can anybody help me?

Thanks in advance.
Marcus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Several Lattice plots in one Plot

2010-09-30 Thread Marcus Drescher
Hi all,

I've been trying for hours, but I do not find a Solution. I want to plot 12 
variables over time in separate diagrams in one plot/window using lattice. Two 
columns, six rows. I used print with the split command, but the graphics are 
getting really small. Can someone please help me.

Following data example:
dta = data.frame(
day=c(1,2,3,4,5,6,7),
var11=c(1,2,2,4,5,3,2),
var12=c(1,2,2,4,5,3,2),
var13=c(1,2,2,4,5,3,2),
var14=c(1,2,2,4,5,3,2),
var15=c(1,2,2,4,5,3,2),
var16=c(1,2,2,4,5,3,2),
var17=c(1,2,2,4,5,3,2),
var18=c(1,2,2,4,5,3,2),
var19=c(1,2,2,4,5,3,2),
var10=c(1,2,2,4,5,3,2),
var11=c(1,2,2,4,5,3,2),
var12=c(1,2,2,4,5,3,2))

Any idea how I can plot varXX over day like xyplot(var11 ~ day, data=dta, 
type='b', scales=list(cex=0.5), xlab=NULL, ylab=list(cex=0.5)) and get readable 
graphs?

Thanks in advance.
Marcus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to calc ratios base on current and previous row?

2010-08-27 Thread Marcus Drescher
Hi all,

I want to calculate in each row a ratio based on number in the current row and 
the previous row.
Is there a way to do this without for-loops because that is extremely slow.

A   B   
[1] 2   2   
[2] 2   3   
[3] 4   5,5
...

B2 = A2 + 0.5*B1


Thanks in advance.
Best
Marcus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Means from selected columns in a data frame

2010-07-20 Thread Marcus Drescher
Hi all,

I have a dataframe with survey data. Now I want to calculate means from several 
but not all columns (e.g. a1, a2, a3) and save them in a new separate column 
(e.g. a).

Like: a = mean(a1, a2, a3)

Can someone help me or give me the right key word to look for?

Thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.