I am trying to fit several functional data functions with several Gauss bell functions. The method used is R-NLS function. But it is difficult to obtain the initial estimate adequately, such a method can be together.
Is it possible to visualize an initial estimate before the optimization period
Library (signal) # Load data from file spectrator & lt;
- read.table ("LIA159.UXD") # Filtering between extract variables and signal gauge scatter vessels & lt; - Spare $ V1 Signal & lt; - medfilt1 (ghost $ V2, n = 5) # Several non-linear fit signal packs have several Gauss bells & lt; - NLS (signal ~ bg + a * scattergel + h1 * xp (- ((scattering - m1) / s1) ^ 2) + h2 * xp (- ((scattering - m2) / s2) ^ 2 ) + H3 * APP (- (ScatterGel-M3) / S3) ^ 2) + H4 * APP (- (Villain - M4) / S4) ^ 2) + H5 * XP (- ^ (2) + H7 * XP (- ((villain - M7) / S7) ^ 2), start = (6 ^) (+ 2) + H6 * XP (- (Scatterjungal-M6) / S6) ^ 2) List (H1 = 2300, M1 = 23.42, S1 = 0.3, H2 = 900, M2 = 11.64, S2 = 0.2, H3 = 100, M3 = 34.80, S3 = 0.6, H4 = 6, M4 = 39.43, S4 = 1.3, H5 = 3, M5 = 46.83, S5 = 1.6, H6 = 10, M6 = 60.23, S6 = 0.3, H7 = 10, A 7 = 61.46, S7 = 0.3, bg = 2, a = -0.1)) Show the price of fit print (summary) plot (signal ~ scattergel, t = 'l', axis = f, xlab = expression (2 * theta), ylab = "#" Draw the Fit function on the top of the original data lines (scatterels, guess (race, data.fr (scattergall)), col = 'red')
You go there (see order)
set.seed (10 ) BG & lt; - rnorm (10000,2,0.1) scattergel & lt; - runif (10000, 5, 35) signal & lieutenant; - BG +0.4 * ScatterGel + 2000 * XP (- ((ScatterGel-24) /0.4) ^ 2) + 1000 * APP (- (Scattering -12) / 1.0.14) ^ 2) + Rnorm (10000, sd = 100) Sv & lt; - The list (h1 = 2300, m1 = 23.42, s1 = 0.3, h2 = 900, m2 = 11.64, s2 = 0.2, bg = 2, a = -0.1) res & lt; - NLS (signal ~ BG + A * scatter jet + H1 xap (- ((Scatterangal - M1) / S1) ^ 2) + H2 * APP (- ((villain - M2) / S2) ^ 2 ), Start = SV) signal 2 & lt; - (SV, {BG + A * ScatterGel + H1 * APP (- ((- (1) - H2 * APP (- ((Scattering - M2) / S2) ^ 2) ^ ^ 2)}) id and lieutenant - order (scattergel) plot (signal [id] ~ scentgal [id], t = 'l', axis = f, xlab = expression (2 * theta), ylab = "", col = The "gray" line (scattergel [id], signal 2 [id], col = 'blue', lwd = 2) lines (scattergel [id], prediction (race, data. Frames (scattergall)) [id] Col = 'red', lwd = 2)
if it If your problem does not solve, think about rewriting the question and adding some runnable code that explain the problem.
Comments
Post a Comment