Hello, This is a very basic question, but I don'y know the answer. I have these data delta <- c(28.6-8.825,28.6-8.828,28.6-8.836,28.6-8.845,28.6-8.897,28.6-8.944,28.6-9.027,28.6-9.091,28.6-9.263,28.6-9.4,28.6-9.7,28.6-9.981, 28.6-10.287,28.6-10.48,28.6-10.684,28.6-10.875) ph <- c(4.4,4.6,4.8,5,5.2,5.4,5.6,5.8,6,6.2,6.4,6.6,6.8,7,7.2,7.4) plot(ph,delta,ylab=c(expression(Delta*delta)),xlab="pH") Which kind of model can I fit on these, so that can I predict for a given delta the pH of my sample? Once the model is fitted, how can I plot it on the graph? Best regards, Dani -- Daniel Valverde Saub? Grup de Biologia Molecular de Llevats Facultat de Veterin?ria de la Universitat Aut?noma de Barcelona Edifici V, Campus UAB 08193 Cerdanyola del Vall?s- SPAIN Centro de Investigaci?n Biom?dica en Red en Bioingenier?a, Biomateriales y Nanomedicina (CIBER-BBN) Grup d'Aplicacions Biom?diques de la RMN Facultat de Bioci?ncies Universitat Aut?noma de Barcelona Edifici Cs, Campus UAB 08193 Cerdanyola del Vall?s- SPAIN +34 93 5814126
If you are looking for a parameteric form then a polynomial seems to work: plot(delta ~ ph) for(i in 1:4) lines(ph, fitted(lm(delta ~ poly(ph, i))), col = i, lty = i) legend("topright", legend = 1:4, col = 1:4, lty = 1:4) On Thu, Nov 20, 2008 at 6:53 AM, Dani Valverde <daniel.valverde at uab.cat> wrote:> Hello, > This is a very basic question, but I don'y know the answer. I have these > data > > delta <- > c(28.6-8.825,28.6-8.828,28.6-8.836,28.6-8.845,28.6-8.897,28.6-8.944,28.6-9.027,28.6-9.091,28.6-9.263,28.6-9.4,28.6-9.7,28.6-9.981, > 28.6-10.287,28.6-10.48,28.6-10.684,28.6-10.875) > ph <- c(4.4,4.6,4.8,5,5.2,5.4,5.6,5.8,6,6.2,6.4,6.6,6.8,7,7.2,7.4) > plot(ph,delta,ylab=c(expression(Delta*delta)),xlab="pH") > > Which kind of model can I fit on these, so that can I predict for a given > delta the pH of my sample? Once the model is fitted, how can I plot it on > the graph? > Best regards, > > Dani > > -- > Daniel Valverde Saub? > > Grup de Biologia Molecular de Llevats > Facultat de Veterin?ria de la Universitat Aut?noma de Barcelona > Edifici V, Campus UAB > 08193 Cerdanyola del Vall?s- SPAIN > > Centro de Investigaci?n Biom?dica en Red > en Bioingenier?a, Biomateriales y > Nanomedicina (CIBER-BBN) > > Grup d'Aplicacions Biom?diques de la RMN > Facultat de Bioci?ncies > Universitat Aut?noma de Barcelona > Edifici Cs, Campus UAB > 08193 Cerdanyola del Vall?s- SPAIN > +34 93 5814126 > > ______________________________________________ > R-help at 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. >
you might use the drc-package (equivalently you could use nls with an appropriate "selfstart" model like SSlogis) library(drc) mm<-drm(delta~ph,fct=LL.4()) plot(mm) From your plot I was assuming that "ph" is the independent variable (as modelled above) - so if you want to predict a ph from delta you will need the "inverse" function of your fitted model - you could toy with ED from the drc package or do a simple grid search with "predict". hth. Dani Valverde schrieb:> Hello, > This is a very basic question, but I don'y know the answer. I have > these data > > delta <- > c(28.6-8.825,28.6-8.828,28.6-8.836,28.6-8.845,28.6-8.897,28.6-8.944,28.6-9.027,28.6-9.091,28.6-9.263,28.6-9.4,28.6-9.7,28.6-9.981, > > 28.6-10.287,28.6-10.48,28.6-10.684,28.6-10.875) > ph <- c(4.4,4.6,4.8,5,5.2,5.4,5.6,5.8,6,6.2,6.4,6.6,6.8,7,7.2,7.4) > plot(ph,delta,ylab=c(expression(Delta*delta)),xlab="pH") > > Which kind of model can I fit on these, so that can I predict for a > given delta the pH of my sample? Once the model is fitted, how can I > plot it on the graph? > Best regards, > > Dani >-- Eik Vettorazzi Institut f?r Medizinische Biometrie und Epidemiologie Universit?tsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/42803-8243 F ++49/40/42803-7790