|
From: Bastian M. <bma...@we...> - 2013-06-14 06:25:39
|
Am 14.06.2013 02:07, schrieb Ethan A Merritt:
> Current documentation for "fit" says
>
> Note that if you don't pecify a `using` option at all, no z standard
> deviations are read from the datafile even if it does have a third
> column, so you'll always get unit weights.
>
> But from looking at the code I think this is not true. If there is
> no using spec then the number of independent variables is always two
> less than the number of columns in the input file, and the final
> input column is indeed interpreted as a standard deviation on z.
>
I think the documentation is correct, albeit somewhat unclear.
Previously fit used to support only a maximum of two independent
variables and I think this statement stems from that era as it refers to
a "third" column.
Actually, the code says
columns = df_open(file_name, 7, NULL); /* up to 7 using specs
allowed */
df_open() is supposed to "return number of using specs", so columns == 0
if we do not have using specs. The number of indep. variables is
determined in the following line:
num_indep = (columns < 3) ? 1 : columns - 2;
Which means num_indep == 1 without using specs.
And later, the "error" is saved by the following line:
/* only use error from data file if _explicitly_ asked for by
* a using spec
*/
err_data[num_data++] = (columns > 2) ? v[i] : 1;
Again, we obtain unit weight without using specs.
Bastian
> The comment in the fit.c source code is also wrong, as it claims
> that the standard deviation is used only if there is an explicit
> using spec.
>
> Have I misread this?
>
> Ethan
|