Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Responding to @jbssm comment, @BenBolker solution seems to give very reasonable results:</p> <pre><code>vCenter_slope &lt;- 600.7472 flN &lt;- transform(flN,w=1/as.numeric(timeError_4_8)^2) # slope fixed m1 &lt;- lm(as.numeric(arrivalTime_4_8) ~ 1 + offset(vCenter*vCenter_slope), data = flN, weights=w) # slope chosen by lm(...) m0 &lt;- lm(as.numeric(arrivalTime_4_8) ~ vCenter, data=flN, weights=w) library(ggplot2) ggp &lt;- ggplot(flN) ggp &lt;- ggp + geom_point(aes(x=vCenter,y=arrivalTime_4_8)) ggp &lt;- ggp + geom_errorbar(aes(x=vCenter, ymin=arrivalTime_4_8-timeError_4_8,ymax=arrivalTime_4_8+timeError_4_8),width=0) ggp &lt;- ggp + geom_errorbarh(aes(x=vCenter, y=arrivalTime_4_8, xmax=vHigh, xmin=vLow),height=0) ggp &lt;- ggp + geom_abline(slope=600.7472, intercept=coef(m1)[1]) ggp &lt;- ggp + geom_abline(slope=coef(m0)[2], intercept=coef(m0)[1],color="red") ggp </code></pre> <p><img src="https://i.stack.imgur.com/PEis4.png" alt=""></p> <p>The red line allows <code>lm(...)</code> to set the slope, the black line uses fixed slope. Note that the black line is further away from the first two <code>vCenter</code> points than you might expect, because you're weighting inversely to error in <code>vCenter</code>. If this is your whole dataset, then using weights is highly questionable.</p> <p>Finally, you can read up on "errors-in-variables" models <a href="http://en.wikipedia.org/wiki/Errors-in-variables_models" rel="nofollow noreferrer">here</a> and <a href="http://personalpages.manchester.ac.uk/staff/Graham.Dunn/MSc%20Biostatistics/Linear%20Regression%20with%20errors.pdf" rel="nofollow noreferrer">here</a>. After reading these, you might want to look at the <a href="http://cran.r-project.org/web/packages/MethComp/MethComp.pdf" rel="nofollow noreferrer">MethComp</a> package, which supports `Deming Regression' (one type of errors-in-variables regression).</p>
 

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