Menu

Weighted Multi-Branch Fitting

Help
wally
2016-04-26
2016-05-01
  • wally

    wally - 2016-04-26

    Hello,

    I have a problem with the multi-branch fitting procedure. According to the manual it should be possible to execute a weighted fit. I have 1 independent variable (x), 2 dependent variables (y) and the 2 associated standard deviations (sy).
    My file looks like this:

    Column1...Column5
    x y1 sy1 y2 sy2

    and the "code"

    f(x,y) = (y==0) ? A1(x,a,b) : A2(x,a,b)
    fit f(x,y) 'file.txt' using 1:-2:2:4:3:5 yerror via a,b

    My problem is, that I don't know how to sort the columns after using (1:-2:2:4:3:5 or 1:-2:2:3:4:5 ?) and what errorvariable belongs after the column index (yerror, zerror)?
    Without weighting, using only 1:-2:2:4 everythings works, but with weighting it doesn't. I appreciate your help.

    Greets wallies

     
  • Bastian Märkisch

    The problem addressed by the multi-branch fit as described in the manual/help is for fitting multiple (separate) datasets in one file. That is they can be distinguished e.g. by datafile index column(-2) and are of the form x:z:s (indep., dependent, error). From your description your problem is different, even in the non-weighted case as you have two dependent variables on the same line. For now I do not see a way to fit that using gnuplot without re-ordering your data file and then use the multi-branch approach:

    x1 y11 s11
    ...
    xn y1n s1n
    
    x1 x21 s21
    ...
    xn y2n s2n
    

    Where y11 denotes first y1 value, y1n n-th y1value etc.

    The fit command would then look like

    fit f(x,y) 'file.txt' using 1:-2:2:3 zerror via a,b.`
    

    Exactly as described in help fit multi-branch.

     
  • wally

    wally - 2016-05-01

    Hello Bastian,

    thanks for your help. Had to use 1:-1:2:3 instead of your suggestion, but it works now.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.