Note that there are some explanatory texts on larger screens.

plurals
  1. POLinear fit with a previously known slope
    primarykey
    data
    text
    <p>I'm trying to fit a linear function for whom I know the slope to this data in R:</p> <pre><code>&gt; flN eCenter eLow eHigh arrivalTime_4_8 timeError_4_8 vCenter vLow vHigh 1 56.4997 60.25967 52.73972 2012-05-17 02:01:44 41.01283 2.298964 2.236939 2.367869 2 105.5787 108.02476 103.13254 2012-05-17 01:57:37 27.06803 1.787009 1.771748 1.802860 3 164.0613 166.50385 161.61884 2012-05-17 01:49:47 60.42015 1.530334 1.522997 1.537860 4 226.9886 229.78374 224.19346 2012-05-17 01:49:20 50.83871 1.386016 1.381233 1.390904 </code></pre> <p>My Y is <code>arrivalTime_4_8</code> and the error in Y is <code>timeError_4_8</code>. My X is <code>vCenter</code> and the error <code>vHigh</code> and <code>vLow</code> for the upper and lower values.</p> <p>So, have 3 problems about this (I'll put them in order of importance):</p> <p>1 - How do I fit a linear function with a set slope? I tried to use <code>lm</code>, but I can't find a way to put the slope there:</p> <pre><code>lm(formula = arrivalTime_4_8 ~ vCenter, data = flN) </code></pre> <p>2 - I know I must use weights = 1/sqrt(error) to get a weighted fit, but how do I do that with a timeframe axis?</p> <p>3 - How do I calculate the weights to use if I have the error measurements in 2 axis? A simple squared sum?</p> <pre><code>&gt; dput(flN) structure(list(eCenter = c(56.4996953402131, 105.578651367445, 164.061343347697, 226.988601498086), eLow = c(60.2596687117468, 108.024759195324, 166.503850666149, 229.78374170578), eHigh = c(52.7397219686794, 103.132543539565, 161.618836029245, 224.193461290392), arrivalTime_4_8 = structure(c(1337216504.88343, 1337216257.43636, 1337215787.45439, 1337215760.18075), tzone = "", class = c("POSIXct", "POSIXt")), timeError_4_8 = c(41.0128309582924, 27.0680250428967, 60.4201539087451, 50.8387114506802), vCenter = c(2.29896400265163, 1.78700866407098, 1.53033400915538, 1.38601563560752), vLow = c(2.23693860876912, 1.77174836673712, 1.52299693760316, 1.38123278889559), vHigh = c(2.36786898717605, 1.80286021104626, 1.5378599964982, 1.39090403398638)), .Names = c("eCenter", "eLow", "eHigh", "arrivalTime_4_8", "timeError_4_8", "vCenter", "vLow", "vHigh"), row.names = c(NA, -4L), class = "data.frame") </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload