[R] pairs(), no axis labels/values for upper panel?

2011-01-24 Thread Steffen Fleischer
Dear all,

I want to draw a graph that contains the scatterplot matrix in the lower panel 
and coefficients in the upper panel. I used and adapted the example for the 
function pairs but cannot figure out how to get no values and ticks in the 
upper panel (the values should only be in the lower panel). The upper panel 
looks odd to me this way. Any hints?

Thanks in advance
Steffen


Here is an example what the graph looks like:
#
data(mtcars)
panel.cor - function(a, b, digits=2,  ...)
 {
 
usr - par(usr); on.exit(par(usr))
 par(usr = c(0, 1, 0, 1))
 x-cbind(a,b)
 x-na.omit(x)
 n - nrow(x)
 pp - c(0.025, 0.975)
 corx - cor(x,method=s)[1, 2]
 CI-c(tanh(atanh(corx) + qnorm(pp)/sqrt((n - 3)/1.06)))
 txt1 - paste(rho =,format(c(corx, 0.123456789), digits=digits)[1])
 txt2-paste((,format(c(CI,0.123456789)[1],digits=digits),; 
,format(c(CI,0.123456789)[2],digits=digits),),sep=)
 txt3-paste(N =,round(n,0))
 txt - paste(txt1,\n,95%KI ,txt2,\n,txt3, sep=)
 text(0.5, 0.5, txt,cex=.8)
 }
 
diag.cor-function(a,b, ...)
{
usr - par(usr); on.exit(par(usr))
par(usr = c(0, 1, 0,1))
rect(0,0,1,1,col=grey)
 }

pairs(mtcars[1:4],upper.panel=panel.cor,diag.panel=diag.cor,label.pos=0.5)
#

__
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] treatment effects with lme (repeated measurements)

2010-12-03 Thread Steffen Fleischer
Dear,

I want to analyze an outcome in an RCT using lme but I am not sure that I have 
chosen the right way for the model.
We measured the outcome three times repeatedly in the same patient. One time 
before intervention and two times after intervention. I wanted to adjust for 
the correlated data in the repeated measurement and baseline differences in the 
variable in order to get the treatment effect.

Here the model:
lme(outcome~treatment*time+baseline; random=~1|id)

for the data structure:

id   time  outcome  baseline  treatment
1 1 10   5 1
1 2 12   5 1
2 1
.
.
.

alternatively I could use 3 rows per participant, omitting baseline as a 
variable as it would be included in outcome and time then.
The model then would be:
lme(outcome~treatment*time; random=~1|id)


I am not sure which way is better/right or if there is a third alternative for 
this problem.

Thanks in advance

Steffen Fleischer

__
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.