[R] Re : Re : ReferenceClasses examples {method}
I hadn't found any message on this subject. Nevertheless you're right again : I've posted this report on r-devel-list where it obviously belongs... Marc - Message d'origine De : David Winsemius À : Marc Carpentier Cc : r-help@r-project.org Envoyé le : Ven 28 janvier 2011, 18h 59min 16s Objet : Re: Re : [R] ReferenceClasses examples {method} On Jan 28, 2011, at 12:35 PM, Marc Carpentier wrote: > Right. Shame on me : Friday's tiredness ; I don't know why I stuck on that. > Please just consider the main topic of my message, regarding the example of > ReferenceClasses (supposing it's appropriate) and sorry for the subsequent > question... I'm definitely the wrong one to tackle any S4 or ReferenceClasses questions. There have been some discussion on r-devel about how to pick up the ReferenceClasses methods but they flew right over my greying head. The latest incarnation of Baron's RSiteSearch allows searching the r-devel archives: http://search.r-project.org/cgi-bin/namazu.cgi?query=ReferenceClasses&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp10&idxname=R-devel And maybe other search strings could be even more productive, since I only tried one. I would have thought the ReferenceC;asses part of your question to be more appropriate for r-devel anyway. --David. > > > - Message d'origine > > De : David Winsemius > À : Marc Carpentier > Cc : r-help@r-project.org > Envoyé le : Ven 28 janvier 2011, 17h 39min 59s > Objet : Re: [R] ReferenceClasses examples {method} > > > On Jan 28, 2011, at 11:05 AM, Marc Carpentier wrote: > >> Dear help, dear John Chambers, >> I'm trying to learn OOP-possibilities in R and I was going through the >> documentation 'ReferenceClasses {methods}'. (great work, by the way...) >> Reading associated Examples, something bothers me : it seems to me that there >> are errors in 'edit' and 'undo' methods. I think that : >> - 'undo' should update 'edits' field with : >> length(edits) <<- length(edits) - 1 #(and not - 2) >> - and for coherence, 'edit' should store modifications in an 'append'-style : >> edits <<- c(edits,list(backup)) #as opposed to c(list(backup),edits) >> >> I hope I'm not wrong. >> >> As a complementary question, suppose one kept 'c(edits,list(backup))', does >> anyone know how todiscard first element(s) of a list? For a vector : >> vedits<<-vedits[-1] >> But lists can't be selected that way ( edits<<- edits [[-1]] #wrong ) > > You are confusing "[" and "[[" > >> ll <- list(a=1,b=2,cc=3) >> ll[-1] > $b > [1] 2 > > $cc > [1] 3 >> > -- > David Winsemius, MD > West Hartford, CT > > > David Winsemius, MD West Hartford, CT __ 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] Re : ReferenceClasses examples {method}
Right. Shame on me : Friday's tiredness ; I don't know why I stuck on that. Please just consider the main topic of my message, regarding the example of ReferenceClasses (supposing it's appropriate) and sorry for the subsequent question... - Message d'origine De : David Winsemius À : Marc Carpentier Cc : r-help@r-project.org Envoyé le : Ven 28 janvier 2011, 17h 39min 59s Objet : Re: [R] ReferenceClasses examples {method} On Jan 28, 2011, at 11:05 AM, Marc Carpentier wrote: > Dear help, dear John Chambers, > I'm trying to learn OOP-possibilities in R and I was going through the > documentation 'ReferenceClasses {methods}'. (great work, by the way...) > Reading associated Examples, something bothers me : it seems to me that there > are errors in 'edit' and 'undo' methods. I think that : > - 'undo' should update 'edits' field with : > length(edits) <<- length(edits) - 1 #(and not - 2) > - and for coherence, 'edit' should store modifications in an 'append'-style : > edits <<- c(edits,list(backup)) #as opposed to c(list(backup),edits) > > I hope I'm not wrong. > > As a complementary question, suppose one kept 'c(edits,list(backup))', does > anyone know how todiscard first element(s) of a list? For a vector : > vedits<<-vedits[-1] > But lists can't be selected that way ( edits<<- edits [[-1]] #wrong ) You are confusing "[" and "[[" > ll <- list(a=1,b=2,cc=3) > ll[-1] $b [1] 2 $cc [1] 3 > -- David Winsemius, MD West Hartford, CT __ 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] ReferenceClasses examples {method}
Dear help, dear John Chambers, I'm trying to learn OOP-possibilities in R and I was going through the documentation 'ReferenceClasses {methods}'. (great work, by the way...) Reading associated Examples, something bothers me : it seems to me that there are errors in 'edit' and 'undo' methods. I think that : - 'undo' should update 'edits' field with : length(edits) <<- length(edits) - 1 #(and not - 2) - and for coherence, 'edit' should store modifications in an 'append'-style : edits <<- c(edits,list(backup)) #as opposed to c(list(backup),edits) I hope I'm not wrong. As a complementary question, suppose one kept 'c(edits,list(backup))', does anyone know how todiscard first element(s) of a list? For a vector : vedits<<-vedits[-1] But lists can't be selected that way ( edits<<- edits [[-1]] #wrong ) Bye. Marc [[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] Re : Re : Re : Nomogram with multiple interactions (package rms)
Thanks for the answer. Unfortunately, I'm not yet skilled enough to do such a thing. I had a look on the code and I'll try to understand it, as a good exercise. I thought about sending fake fit objects to nomogram() derived from the original one : - orignal : f2<- cph(Surv(d.time,death) ~ sex*(rcs(cholesterol,4)+blood.pressure) - manually derived : * fMale : with coef rcs(cholesterol,4) and blood.pressure form f2, no sex effect * fFemale : with "agregated" coef sex:rcs(cholesterol,4) for cholesterol and sex:blood.pressure for BP and an obligatory sex effect. But I failed to fool your function. Had to try though... Marc - Message d'origine De : Frank E Harrell Jr À : Marc Carpentier Cc : r-help-request Mailing List Envoyé le : Jeu 20 mai 2010, 15h 30min 27s Objet : Re: Re : Re : [R] Nomogram with multiple interactions (package rms) On 05/20/2010 01:42 AM, Marc Carpentier wrote: > Thank you for your responses, but I don't think you're right about the doc... > I carefully looked at it before posting and ran the examples, looked in > Vanderbilt Biostat doc, and just looked again example(nomogram) : > 1st example : categorical*continous : two axes for each sex > f<- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure) Hi Marc, My apologies; I misread my own example. This will take some digging into the code. If you have time to do this before I do, code change suggestions welcomed. Frank > > > 2nd : continous*continous : one "age" axe for each specified value of > cholesterol > g<- lrm(y ~ sex + rcs(age,3)*rcs(cholesterol,3)) > > 3rd and 4th : categorical*continous : two axes for each sex (4th with fun) > f<- psm(Surv(d.time,death) ~ sex*age, dist='lognormal') > > 5th : categorical*continous : two axes for each sex (with fun) > g<- lrm(Y ~ age+rcs(cholesterol,4)*sex) > > I'm desperately trying to represent a case of > categorical*(continous+continous) : > f2<- cph(Surv(d.time,death) ~ sex*(rcs(cholesterol,4)+blood.pressure) > The best solution I can think of is to draw one nomogram for each sex : > Assuming 'male' is the ref level of sex : > 1st nomogram : one axe for rcs(cholesterol,4), one axe for blood.pressure > 2nd nomogram : one axe for sex:rcs(cholesterol,4), one axe for > sex:blood.pressure, both shifted because of the sex own effect. > (I badly draw it in my previous mail) > I didn't see any example of this "adjustement" of nomogram to 'male' or > 'female'... > > I hope I gave a clearer explanation and I'm not wrong about this unmentioned > case. > > Marc > > > > > - Message d'origine ---- > De : Frank E Harrell Jr > À : Marc Carpentier > Cc : r-help-request Mailing List > Envoyé le : Jeu 20 mai 2010, 0h 55min 32s > Objet : Re: Re : [R] Nomogram with multiple interactions (package rms) > > On 05/19/2010 04:36 PM, Marc Carpentier wrote: >> I'm sorry. I don't understand the "omit" solution, and maybe I mislead you >> with my explanation. >> >> With the data from the "f" exemple of nomogram() : >> Let's declare : >> f2<- cph(Surv(d.time,death) ~ sex*(age+blood.pressure)) >> I guess the best (and maybe the only) way to represent it with a nomogram is >> to plot two nomograms (I couldn't find better). >> Is there a way to have : >> >> Nomogram1 : "male" : >> - points 1-100 --- >> - age ("men") --- >> - blood.pressure ("men") --- >> - linear predictor --- >> >> And nomogram2 : "female" : >> - points 1-100 --- >> - age ("female") --- >> - blood.pressure ("female") --- >> - linear predictor --- >> >> As I said I tried and failed (nomogram() still wants me to define >> interact=list(...)) with : >> plot(nomorgam(f2, adj.to=list(sex="male")) #and "female" for the other one >> >> Marc > > I think the documentation tells you how to do this. But you failed to > look at the output from example(nomogram). In one of the examples two > continuous predictors have two axes each, with male and female in close > proximity. Or maybe I'm just missing your point. > > Frank > >> >> >> >> - Message d'origine >> De : Frank E Harrell Jr >> À : Marc Carpentier; r-help-request Mailing >> List >> Envoyé le : Mer 19 mai 2010, 22h 28min 51s >> Objet : Re: [R] Nomogram with multiple interactions (package rms) >> >> On 05/19/2010 03:
[R] Re : Re : Nomogram with multiple interactions (package rms)
Thank you for your responses, but I don't think you're right about the doc... I carefully looked at it before posting and ran the examples, looked in Vanderbilt Biostat doc, and just looked again example(nomogram) : 1st example : categorical*continous : two axes for each sex f <- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure) 2nd : continous*continous : one "age" axe for each specified value of cholesterol g <- lrm(y ~ sex + rcs(age,3)*rcs(cholesterol,3)) 3rd and 4th : categorical*continous : two axes for each sex (4th with fun) f <- psm(Surv(d.time,death) ~ sex*age, dist='lognormal') 5th : categorical*continous : two axes for each sex (with fun) g <- lrm(Y ~ age+rcs(cholesterol,4)*sex) I'm desperately trying to represent a case of categorical*(continous+continous) : f2 <- cph(Surv(d.time,death) ~ sex*(rcs(cholesterol,4)+blood.pressure) The best solution I can think of is to draw one nomogram for each sex : Assuming 'male' is the ref level of sex : 1st nomogram : one axe for rcs(cholesterol,4), one axe for blood.pressure 2nd nomogram : one axe for sex:rcs(cholesterol,4), one axe for sex:blood.pressure, both shifted because of the sex own effect. (I badly draw it in my previous mail) I didn't see any example of this "adjustement" of nomogram to 'male' or 'female'... I hope I gave a clearer explanation and I'm not wrong about this unmentioned case. Marc - Message d'origine De : Frank E Harrell Jr À : Marc Carpentier Cc : r-help-request Mailing List Envoyé le : Jeu 20 mai 2010, 0h 55min 32s Objet : Re: Re : [R] Nomogram with multiple interactions (package rms) On 05/19/2010 04:36 PM, Marc Carpentier wrote: > I'm sorry. I don't understand the "omit" solution, and maybe I mislead you > with my explanation. > > With the data from the "f" exemple of nomogram() : > Let's declare : > f2<- cph(Surv(d.time,death) ~ sex*(age+blood.pressure)) > I guess the best (and maybe the only) way to represent it with a nomogram is > to plot two nomograms (I couldn't find better). > Is there a way to have : > > Nomogram1 : "male" : > - points 1-100 --- > - age ("men") --- > - blood.pressure ("men") --- > - linear predictor --- > > And nomogram2 : "female" : > - points 1-100 --- > - age ("female") --- > - blood.pressure ("female") --- > - linear predictor --- > > As I said I tried and failed (nomogram() still wants me to define > interact=list(...)) with : > plot(nomorgam(f2, adj.to=list(sex="male")) #and "female" for the other one > > Marc I think the documentation tells you how to do this. But you failed to look at the output from example(nomogram). In one of the examples two continuous predictors have two axes each, with male and female in close proximity. Or maybe I'm just missing your point. Frank > > > > - Message d'origine > De : Frank E Harrell Jr > À : Marc Carpentier; r-help-request Mailing > List > Envoyé le : Mer 19 mai 2010, 22h 28min 51s > Objet : Re: [R] Nomogram with multiple interactions (package rms) > > On 05/19/2010 03:17 PM, Marc Carpentier wrote: >> Dear list, I'm facing the following problem : A cox model with my sex >> variable interacting with several continuous variables : >> cph(S~sex*(x1+x2+x3)) And I'd like to make a nomogram. I know it's a >> bit tricky and one mights argue that nomogram is not a good a >> choice... I could use the parameter >> interact=list(sex=("male","female"),x1=c(a,b,c))... but with rcs or >> pol transformations of x1, x2 and x3, the choice of the >> categorization (a,b,c,...) is arbitrary and the nomogram not so >> useful... Considering that sex is the problem, I thought I could draw >> two nomograms, one for each sex... based on one model. These would be >> great. Do you think it's possible ? > > Yes, you can specify constant predictors not to draw with the omit= > argument. But try first to draw everything. Shouldn't you just get 2 > axes each for x1 x2 x3? > >> >> Taking the exemple of the help of nomogram() (package "rms") : f<- >> psm(Surv(d.time,death) ~ sex*age, dist=if(.R.)'lognormal' else >> 'gaussian') > > Drop the if(.R.) which was just corrected in the documentation. Use > dist='lognormal' > > Frank > >> >> Let's add the previously defined blood.pressure effect with an >> interaction with sex too (with cph) : f2<- cph(Surv(d.
[R] Re : Nomogram with multiple interactions (package rms)
I'm sorry. I don't understand the "omit" solution, and maybe I mislead you with my explanation. With the data from the "f" exemple of nomogram() : Let's declare : f2 <- cph(Surv(d.time,death) ~ sex*(age+blood.pressure)) I guess the best (and maybe the only) way to represent it with a nomogram is to plot two nomograms (I couldn't find better). Is there a way to have : Nomogram1 : "male" : - points 1-100 --- - age ("men") --- - blood.pressure ("men") --- - linear predictor --- And nomogram2 : "female" : - points 1-100 --- - age ("female") --- - blood.pressure ("female") --- - linear predictor --- As I said I tried and failed (nomogram() still wants me to define interact=list(...)) with : plot(nomorgam(f2, adj.to=list(sex="male")) #and "female" for the other one Marc - Message d'origine De : Frank E Harrell Jr À : Marc Carpentier ; r-help-request Mailing List Envoyé le : Mer 19 mai 2010, 22h 28min 51s Objet : Re: [R] Nomogram with multiple interactions (package rms) On 05/19/2010 03:17 PM, Marc Carpentier wrote: > Dear list, I'm facing the following problem : A cox model with my sex > variable interacting with several continuous variables : > cph(S~sex*(x1+x2+x3)) And I'd like to make a nomogram. I know it's a > bit tricky and one mights argue that nomogram is not a good a > choice... I could use the parameter > interact=list(sex=("male","female"),x1=c(a,b,c))... but with rcs or > pol transformations of x1, x2 and x3, the choice of the > categorization (a,b,c,...) is arbitrary and the nomogram not so > useful... Considering that sex is the problem, I thought I could draw > two nomograms, one for each sex... based on one model. These would be > great. Do you think it's possible ? Yes, you can specify constant predictors not to draw with the omit= argument. But try first to draw everything. Shouldn't you just get 2 axes each for x1 x2 x3? > > Taking the exemple of the help of nomogram() (package "rms") : f<- > psm(Surv(d.time,death) ~ sex*age, dist=if(.R.)'lognormal' else > 'gaussian') Drop the if(.R.) which was just corrected in the documentation. Use dist='lognormal' Frank > > Let's add the previously defined blood.pressure effect with an > interaction with sex too (with cph) : f2<- cph(Surv(d.time,death) ~ > sex*(age+blood.pressure)) > > I thought of the parameter adt.to : plot(nomorgam(f2, > adj.to=list(sex="male")) #and "female" for the other one > > But nomogram() still wants me to define interact=list(...) Thanks for > any advice you might have (with adj.to or any alternative...) > > Marc Carpentier > -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ 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] Nomogram with multiple interactions (package rms)
Dear list, I'm facing the following problem : A cox model with my sex variable interacting with several continuous variables : cph(S~sex*(x1+x2+x3)) And I'd like to make a nomogram. I know it's a bit tricky and one mights argue that nomogram is not a good a choice... I could use the parameter interact=list(sex=("male","female"),x1=c(a,b,c))... but with rcs or pol transformations of x1, x2 and x3, the choice of the categorization (a,b,c,...) is arbitrary and the nomogram not so useful... Considering that sex is the problem, I thought I could draw two nomograms, one for each sex... based on one model. These would be great. Do you think it's possible ? Taking the exemple of the help of nomogram() (package "rms") : f <- psm(Surv(d.time,death) ~ sex*age, dist=if(.R.)'lognormal' else 'gaussian') Let's add the previously defined blood.pressure effect with an interaction with sex too (with cph) : f2 <- cph(Surv(d.time,death) ~ sex*(age+blood.pressure)) I thought of the parameter adt.to : plot(nomorgam(f2, adj.to=list(sex="male")) #and "female" for the other one But nomogram() still wants me to define interact=list(...) Thanks for any advice you might have (with adj.to or any alternative...) Marc Carpentier __ 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] Re : Re: Re: aregImpute (Hmisc package) : error in matxv(X, xcof)...
Very useful code to investigate not only my problem ! I'll use it and keep it in mind for future works. Thank you very much for your help. And of course for the rest : packages, open-courses... among others ! Very helpful too. (Sorry for the wide dataset. I thought it would be attached and maybe useful but saw it entirely pasted in my daily report ; I didn't know that would occur) Kind regards. Marc >Marc, > >In this particular case the code alone would have been sufficient. > >To isolate the problem try the following: > >require(Hmisc) >v <- varclus(~ variable1 + variable2 + ... all other variables given to >aregImpute, data=...) >plot(v) > >redun(~variable1 + variable2 + ... all others, data=...) > >Frank __ 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] Re : aregImpute (Hmisc package) : error in matxv(X, xcof)...
Ok. I was afraid to refer to a known and obvious error. Here is a testing dataset (pb1.csv) and commented code (pb1.R) with the problems. Thanks for any help. Marc De : Uwe Ligges À : Marc Carpentier Cc : r-help@r-project.org Envoyé le : Mar 4 mai 2010, 13 h 52 min 31 s Objet : Re: [R] aregImpute (Hmisc package) : error in matxv(X, xcof)... Having reproducible examples including data and the actual call that lead to the error would be really helpful to be able to help. Uwe Ligges On 04.05.2010 12:23, Marc Carpentier wrote: > Dear r-help list, > I'm trying to use multiple imputation for my MSc thesis. > Having good exemples using the Hmisc package, I tried the aregImpute > function. But with my own dataset, I have the following error : > > Erreur dans matxv(X, xcof) : columns in a (51) must be<= length of b (50) > De plus : Warning message: > In f$xcoef[, 1] * f$xcenter : >la taille d'un objet plus long n'est pas multiple de la taille d'un objet > plus court >= longer object length is not a multiple of shorter object length > > I first tried to "I()" all the continuous variables but the same error occurs > with different numbers : > Erreur dans matxv(X, xcof) : columns in a (37) must be<= length of b (36)... > > I'm a student and I'm not familiar with possible constraints in a dataset to > be effectively imputed. I just found this previous message, where the > author's autoreply suggests that particular distributions might be an > explanation of algorithms failure : > http://www.mail-archive.com/r-help@r-project.org/msg53534.html > > Does anyone know if these messages reflect a specific problem in my dataset ? > And if the number mentioned might give me a hint on which column to look at > (and maybe transform or ignore for the imputation) ? > Thanks for any advice you might have. > > Marc > > > > > [[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-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] aregImpute (Hmisc package) : error in matxv(X, xcof)...
Dear r-help list, I'm trying to use multiple imputation for my MSc thesis. Having good exemples using the Hmisc package, I tried the aregImpute function. But with my own dataset, I have the following error : Erreur dans matxv(X, xcof) : columns in a (51) must be <= length of b (50) De plus : Warning message: In f$xcoef[, 1] * f$xcenter : la taille d'un objet plus long n'est pas multiple de la taille d'un objet plus court = longer object length is not a multiple of shorter object length I first tried to "I()" all the continuous variables but the same error occurs with different numbers : Erreur dans matxv(X, xcof) : columns in a (37) must be <= length of b (36)... I'm a student and I'm not familiar with possible constraints in a dataset to be effectively imputed. I just found this previous message, where the author's autoreply suggests that particular distributions might be an explanation of algorithms failure : http://www.mail-archive.com/r-help@r-project.org/msg53534.html Does anyone know if these messages reflect a specific problem in my dataset ? And if the number mentioned might give me a hint on which column to look at (and maybe transform or ignore for the imputation) ? Thanks for any advice you might have. Marc [[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] "ask=F" option with plot.gam
Hello. I'd like to plot only one component smooth function of a gam model (for example the second) (library mgcv). So, I did : plot(my.gam, select=2, ask=F) But plot.gam doesn't seem to understand the "ask" option, so I can't deactivate the interactive plotting. I tried and failed by forcing it through : par(ask=F) And the "page" option of plot.gam (automatic layout) seems to be in conflit with the one "select" : plot(my.gam, select=2, page=1) #does par(mfrow=c(2,1) (if 2 "s()" in the model) even though it plots only the second function... Does anyone have a tip on this ? (it's to use in a Sweave document, not just bug tracking...) Thank you for your help. Marc __ 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] problem with 'abline' in a regression with repeated measures
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.