Hi,

I will try to explain what it is I need to do, how far I am in doing it yet
and where my problem is:

I have a lot of x,y values I need to fit a non linear function through.
Subsequently, I need to find the intersection point of this fitted curve
with y=1.01

The problem is I have a lot of values so I want to be able to do it all at
once.

I already imported my excel file of the points I have to use.

The things I already have are following (not all of the data is visible
because otherwise the file would be too long for this email, but i just
showed part of my data so you could better understand my problem):


______________
          X1242   X1242.5     X1243   X1243.5     X1244   X1244.5
X1245   X1245.5     X1246   X1246.5     X1247   X1247.5     X1248
X1248.5     X1249 =>  names of each data set ( corresponds to wavelengths,
ranges from 400 to 2500 with 0.5 steps => a lot of points!)
18.14 0.9860316 0.9860272 0.9860203 0.9860121 0.9860044 0.9859994 0.9859971
0.9859976 0.9859999 0.9860035 0.9860069 0.9860103 0.9860128 0.9860151
0.9860178
15.8  0.9857134 0.9857106 0.9857063 0.9857011 0.9856958 0.9856917 0.9856887
0.9856874 0.9856880 0.9856893 0.9856906 0.9856919 0.9856922 0.9856916
0.9856912
13.77 0.9930109 0.9930015 0.9929921 0.9929833 0.9929765 0.9929714 0.9929674
0.9929637 0.9929603 0.9929569 0.9929533 0.9929501 0.9929469 0.9929440
0.9929416
9.03  0.9875374 0.9875321 0.9875242 0.9875140 0.9875024 0.9874921 0.9874840
0.9874793 0.9874780 0.9874802 0.9874835 0.9874869 0.9874877 0.9874857
0.9874801
6.14  0.9900554 0.9900465 0.9900376 0.9900286 0.9900204 0.9900122 0.9900032
0.9899924 0.9899802 0.9899669 0.9899544 0.9899445 0.9899372 0.9899333
0.9899317
4.27  1.0050327 1.0050242 1.0050175 1.0050129 1.0050107 1.0050101 1.0050094
1.0050070 1.0050025 1.0049959 1.0049885 1.0049812 1.0049746 1.0049691
1.0049647
2.77  0.9892697 0.9892585 0.9892454 0.9892311 0.9892164 0.9892030 0.9891906
0.9891796 0.9891704 0.9891624 0.9891550 0.9891480 0.9891401 0.9891320
0.9891235
1.52  0.9979284 0.9979430 0.9979548 0.9979644 0.9979739 0.9979850 0.9979984
0.9980137 0.9980312 0.9980498 0.9980691 0.9980897 0.9981105 0.9981323
0.9981542
These are my x-values                                 and y-values
        X1249.5     X1250   X1250.5     X1251   X1251.5     X1252
X1252.5     X1253   X1253.5     X1254   X1254.5     X1255   X1255.5
X1256   X1256.5
18.14 0.9860214 0.9860261 0.9860320 0.9860377 0.9860425 0.9860456 0.9860462
0.9860449 0.9860433 0.9860422 0.9860417 0.9860428 0.9860444 0.9860456
0.9860456
15.8  0.9856911 0.9856918 0.9856934 0.9856958 0.9856984 0.9857014 0.9857040
0.9857069 0.9857099 0.9857132 0.9857153 0.9857156 0.9857132 0.9857080
0.9857016
13.77 0.9929406 0.9929405 0.9929425 0.9929445 0.9929464 0.9929476 0.9929476
0.9929455 0.9929431 0.9929409 0.9929377 0.9929356 0.9929331 0.9929304
0.9929279
9.03  0.9874721 0.9874641 0.9874578 0.9874542 0.9874529 0.9874541 0.9874556
0.9874563 0.9874565 0.9874551 0.9874527 0.9874498 0.9874461 0.9874415
0.9874371
6.14  0.9899318 0.9899319 0.9899304 0.9899263 0.9899192 0.9899095 0.9898986
0.9898873 0.9898777 0.9898703 0.9898641 0.9898591 0.9898546 0.9898495
0.9898439
4.27  1.0049605 1.0049564 1.0049528 1.0049495 1.0049466 1.0049435 1.0049404
1.0049357 1.0049298 1.0049230 1.0049155 1.0049093 1.0049049 1.0049019
1.0049002
2.77  0.9891158 0.9891100 0.9891058 0.9891036 0.9891013 0.9890986 0.9890943
0.9890873 0.9890789 0.9890691 0.9890583 0.9890485 0.9890395 0.9890323
0.9890266
1.52  0.9981760 0.9981970 0.9982176 0.9982372 0.9982565 0.9982753 0.9982935
0.9983102 0.9983259 0.9983408 0.9983533 0.9983647 0.9983749 0.9983841
0.9983929
          X1257   X1257.5     X1258   X1258.5     X1259   X1259.5
X1260   X1260.5     X1261   X1261.5     X1262   X1262.5     X1263
X1263.5     X1264
18.14 0.9860445 0.9860437 0.9860438 0.9860467 0.9860527 0.9860613 0.9860705
0.9860782 0.9860830 0.9860844 0.9860832 0.9860806 0.9860774 0.9860746
0.9860716
15.8  0.9856955 0.9856925 0.9856930 0.9856967 0.9857032 0.9857098 0.9857162
0.9857213 0.9857248 0.9857268 0.9857283 0.9857298 0.9857314 0.9857340
0.9857374
13.77 0.9929253 0.9929242 0.9929234 0.9929239 0.9929254 0.9929276 0.9929302
0.9929321 0.9929329 0.9929328 0.9929315 0.9929294 0.9929275 0.9929257
0.9929243
9.03  0.9874330 0.9874313 0.9874312 0.9874335 0.9874375 0.9874418 0.9874468
0.9874510 0.9874547 0.9874577 0.9874602 0.9874623 0.9874640 0.9874659
0.9874680
6.14  0.9898392 0.9898366 0.9898360 0.9898381 0.9898417 0.9898455 0.9898484
0.9898489 0.9898469 0.9898432 0.9898392 0.9898363 0.9898354 0.9898371
0.9898402
4.27  1.0048982 1.0048966 1.0048942 1.0048923 1.0048914 1.0048917 1.0048929
1.0048939 1.0048933 1.0048910 1.0048865 1.0048803 1.0048742 1.0048693
1.0048658
2.77  0.9890227 0.9890210 0.9890197 0.9890184 0.9890164 0.9890143 0.9890120
0.9890102 0.9890088 0.9890087 0.9890089 0.9890086 0.9890073 0.9890056
0.9890024
1.52  0.9984034 0.9984168 0.9984328 0.9984514 0.9984707 0.9984899 0.9985069
0.9985223 0.9985357 0.9985479 0.9985593 0.9985694 0.9985778 0.9985845
0.9985890
%% I tried:
> test1<-nls(y~I(1+a*exp(1)^(-b*x)),data=model,start=list(a=1,b=1))
Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
> test1
Nonlinear regression model
  model:  y ~ I(1 + a * exp(1)^(-b * x))
   data:  model
    a     b
12.58  2.66
 residual sum-of-squares: 0.0005495

Number of iterations to convergence: 12
Achieved convergence tolerance: 8.038e-06
>


Now I first tried it with a small data set of only 1 set of x and y values,
and found that the formula I use works so that's ok.
But now the objective is to perform the formula to the total data set and
get an overview of the a and b values *for each other data set (so for each
wavelength), not an average a and b value for everything*.
Is this possible? How do I do it?
_______________________________________________________________

Secondly, for the intersection point determination, I found on the internet
to use the function
>intersection(sequenceInd = NA, sequenceSig = NA, hLine = NA, plot = TRUE)

but when I do this, the response I get is

> intersection(sequenceInd=model,hLine=1.01,plot=TRUE)
Error: could not find function "intersection"

The intersection line is the same for each data set. How can I find the
intersection point for each dataset?
_______________________________________________________________


Thank you so much in advance,

Karen Vandepoel



-- 
Karen

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