Elisa, Part of the issue is that there is no unique solution. You could increase each of the 6 values by a fixed amount to make up the 0.242003 difference in area, or you could increase them proportionally, among many other schemes. I'll outline an approach and you can decide how you want to proceed. 1. Determine the contribution of reach point to the total area: matrix(diff(c(el[1,1], el[,1], el[12,1]), 2)/2) 2. The total contribution from the last 7 values is 1.42607687227. 3. To distribute the change equally over the last 7 values, simply add 0.242003/1.42607687227 = 0.1696984 to each of those 12 values. 4. To distribute unequally, you'll need to work that out yourself, but knowing the relative weights will be the key. Dave
>Date: Thu, 16 Jan 2014 13:24:41 +0000 >From: eliza botto <eliza_bo...@hotmail.com> >To: "r-help@r-project.org" <r-help@r-project.org> >Subject: [R] predefined area under the curve >Message-ID: <blu170-w1360c9aa25d48d8a388cbc689...@phx.gbl> >Content-Type: text/plain > >Dear UseRs of R, >My sincere apologizes in advance if my question isn't relevant to the >operations in R. I actually have the following two columns data, with 12 >rows in it. > dput(el) > >structure(c(-1.42607687227285, -1.0200762327862, -0.736315917376129, > -0.502402223373355, -0.293381232121193, -0.0965586152896391, > 0.0965586152896391, 0.293381232121194, 0.502402223373355, >0.73631591737613, 1.0200762327862, 1.42607687227285, >1.99095972340185, 1.84006682649012, 1.71563586990498, >1.60312301737773, 0.748443534297919, 0.696909774793038, >0.64586377528834, 0.594330015783459, 0.270606020696256, >0.242477807564444, 0.211370068418158, 0.173646844190226), .Dim = >c(12L, 2L), .Dimnames = list( NULL, c("", "GG"))) > >When I plot column 2 against column 1 , i get a curve with an area >[auc(column1,column2)] under it equals to 2.602997. As i am calibrating it >for further simulations therefore i know that the area under the curve should >actually be equal to 2.845. I also know that the first 6 rows have been >located accurately, therefore the rows from 7 to 12 need to be relocated in >such a manner that area under the curve gets equal to or as close as >possible to 2.845. How can I do that? i have been doing it manually but at >the cost of time and accuracy. > >Thankyou very much in advance. >Elisa > [[alternative HTML version deleted]] [[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.