Hi everybody.
I'm just learning to use R. I've got a strange problem and I couldn't find any 
answer to my problem. So here am I.

I want to visualize a model of regression on repeated measures :
5 measures (y) by x-value (lx for log10(x) ; lxf colonn is for as.factor) ; 5 
x-values.

I fail to use 'abline' command (regression's line don't display) in this 
particular context, on a 'stripchart' display. Any idea ?
Here are the few commands that I execute, the lattest being my problem :

> tab <- read.csv2("ex3.csv")
> sapply(tab,data.class)
    sujet         x        xf        lx       lxf         y 
"numeric" "numeric" "numeric" "numeric" "numeric" "numeric" 
> attach(tab)
> lxf <- as.factor(lxf)

> model1 <- lm(y~lx)
> model2 <- lm(y~lxf)
> model3 <- lm(y~lx+lxf)

> ym <- tapply(y,lxf,mean)
> ym
 -0.9  -0.6  -0.3     0   0.3 
 43.0  60.6  77.2  92.2 109.4

> stripchart(y~lx, method="jitter", jitter=.1, vertical=T, pch=20)
> lines (1:5, ym, type="b", pch=4, cex=2, lty=2)
> abline(model1)        ## I don't understand why it doesn't work ; neither do 
> abline(coef(model1) or abline(92,45)
## It usually works on any regression, but stripchart maybe is a special plot ; 
I suspect an absciss misunderstanding by abline...

Thanks for any help.


I simulated this data set :
lx lxf y 
-0,9 -0,9 47 
-0,9 -0,9 41 
-0,9 -0,9 44 
-0,9 -0,9 38 
-0,9 -0,9 45 
-0,6 -0,6 58 
-0,6 -0,6 63 
-0,6 -0,6 58 
-0,6 -0,6 58 
-0,6 -0,6 66 
-0,3 -0,3 78 
-0,3 -0,3 79 
-0,3 -0,3 78 
-0,3 -0,3 77 
-0,3 -0,3 74 
0 0 96 
0 0 91 
0 0 97 
0 0 85 
0 0 92 
0,3 0,3 109 
0,3 0,3 114 
0,3 0,3 111 
0,3 0,3 104 
0,3 0,3 109 


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