Hello Masters,
wishing you all a great 2011 I was also going to ask if anyone knows a quick
and efficient way to plot a regression plane (z~x*y).

I have tried the regr2.plot{HH} function but it is only an educational tool
and has poor graphical properties.

I also tried to run the following script on a fictitious longitudinal
problem, with poor results

set.seed(1234)

id<-c(rep(1,3),rep(2,4),rep(3,2)) # subjects
y<-rchisq(9,df=20) #response
k<-rnorm(9,4,2) # x
time<-as.Date(c("03/07/1981","15/11/1981","03/04/1983","08/12/1979",
"30/12/1979","08/03/1980","12/08/1980","12/08/1973","28/03/1975"),
format="%d/%m/%Y")
fac<-c("m","m","m","f","f","f","f","m","m")# sex


d1<-as.vector(by(time,factor(id),min))
t0<-as.Date(d1,origin=as.Date("1970-01-01"));t0

A<-data.frame(id=c("1","2","3"),t=t0)
B<-data.frame(id=id,tempo=time)
C<-merge(A,B);C

rd<-as.vector(C$tempo-C$t);rd #time centered on sbj specific first
occurrence


mod<-lm(y~rd*k)
newax<- expand.grid(
    days = giorni<-seq(min(rd),max(rd), length=100),
    expl= esplic<- seq(min(k), max(k), length=100)
    )
fit <- predict(mod,data.frame(rd=giorni,k=esplic))
graph <- persp(x=giorni, y=esplic,fit,
 expand=0.5, ticktype="detailed", theta=-45)  #error : z argument not valid

 I would be grateful if someone would give me some suggestions.
Thank u again and happy new year

Federico Bonofiglio

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

Reply via email to