Skip to content

Comparing linear regression coefficients to a slope of 1

12 messages · Bert Gunter, Catriona Hendry, David Winsemius +2 more

#
Is this homework?  
 
    PLEASE do read the posting guide 
       http://www.R-project.org/posting-guide.html

albyn
On Sat, Nov 24, 2012 at 07:27:25PM -0500, Catriona Hendry wrote:

  
    
#
On Nov 24, 2012, at 4:27 PM, Catriona Hendry wrote:

            
If the slope were in fact == 1 then what would the offset need to be  
to "correct it" so that it were == 0?

Failing this effort at clapping one hand, then please produce the  
requested dataset and other bits of window dressing requested in the  
Posting Guide, including whether this is a homework problem and what  
your academic institution's expectations are for soliciting help over  
the Internet.
#
Hi,

@ Albyn, David.. No, its not homework. Its basic groundwork for testing
allometric relationships for a graduate project I am working on. I read the
guide before posting, I spent half the day trying to understand how I am
going wrong based on the advice given to others.

@Bert, David... I apologise for the lack of code, I wasn't sure how to
explain my problem and I guess I went about it the wrong way.

I do think this is what I need to be doing, I am testing allometric
relationships of body size against a predicted isometric (1:1)
relationship. So I would like to know if the relationship between my
variables deviates from that.

Hopefully the information below will be what is needed.

Here is the part of the code relevant to the regression and plot:
Contrast_log_MTL_ALL, offset=1*Contrast_log_MTL_ALL)
abline(Regression_PhyloContrasts_ALL)

the plot that resulted is attached as an image file.


Below are the vectors of my variables. The are converted from other values
imported and indexed from a csv file, so unfortunately I don't have matrix
set up for them.

  Contrast_log_FTL_ALL Contrast_Log_MTL_ALL  83 0.226593 0.284521  84
0.165517 0.084462  85 -0.1902 -0.0055  86 0.585176 0.639916  87 -0.01078
0.118011  88 0.161142 0.073762  89 -0.08566 -0.04788  90 -0.13818 -0.0524
91 -0.02504 -0.21099  92 -0.05027 -0.07594  93 -0.11399 -0.07251  94
-0.07299 -0.08247  95 -0.09507 -0.04817  96 0.207591 0.151695  97 -0.14224
-0.05097  98 0.06375 -0.0229  99 0.04607 0.06246  100 0.257389 0.190531  101
-0.0612 -0.10902  102 -0.1981 -0.24698  103 -0.12328 -0.36942  104 0.269877
0.341989  105 0.125377 0.227183  106 0.087038 -0.05962  107 0.114929
0.096112  108 0.252807 0.305583  109 -0.0895 -0.08586  110 -0.38483 -0.20671
111 -0.72506 -0.63785  112 -0.37212 -0.21458  113 0.010348 0.117577  114
-0.09625 -0.0059  115 -0.26291 -0.25986  116 0.056922 0.064041  117 0.051472
-0.09747  118 -0.05691 0.075005  119 0.117095 -0.15497  120 -0.01329
-0.12473  121 0.098725 0.020522  122 -0.0019 -0.01998  123 -0.12446 -0.02312
124 0.019234 0.031391  125 0.385366 0.391766  126 0.495518 0.468946  127
-0.09251 -0.08045  128 0.147965 0.139117  129 -0.03143 -0.02319  130
-0.19801 -0.14924  131 0.014104 -0.01917  132 0.031872 -0.01381  133
-0.01412 -0.04381  134 -0.12864 -0.08527  135 -0.07179 -0.03525  136 0.31003
0.29553  137 -0.09347 -0.11903  138 -0.10706 -0.16654  139 0.078655 0.065509
140 0.08279 -0.00766  141 0.181885 0.001414  142 0.345818 0.496323  143
0.235044 0.095073  144 -0.03022 0.039918  145 0.042577 0.136586  146
0.064208 0.001379  147 -0.02237 -0.03009  148 -3.55E-05 0.040197  149
0.011168 0.087116  150 0.019964 0.071822  151 -0.04602 -0.06616  152
0.083087 0.038592  153 0.032078 0.107237  154 -0.21108 -0.22347  155
0.122959 0.297917  156 -0.05898 0.012547  157 -0.07584 -0.21588  158
-0.00929 -0.06864  159 -0.01211 -0.04559  160 0.090948 0.136582  161
0.016974 0.018259  162 -0.04083 0.016245  163 -0.20328 -0.31678
On Sat, Nov 24, 2012 at 8:22 PM, Bert Gunter <gunter.berton at gene.com> wrote:

            

  
    
#
On Nov 24, 2012, at 6:05 PM, Catriona Hendry wrote:

            
It's kind of a pain that you spell these different than they are named  
below.
That looks fine. What's the problem? (Now you need to be examining the  
lm-object with the usual R tools. )
abline should be given an argument of 0 for "a" and 1 for "b" if the  
goal were to plot a line for a predicted regression result of unity  
slope. If that's not the goal then you need to be more forthcoming.
No, it's not. Somewhere (not very prominently displayed) on either the  
Posting Guide or on the information page for Rhelp is it stated that  
most attachements are thrown away. They need to be .txt, .png, .pdf,  
or .ps.  They cannot be .csv, .xls, .dat, .sas7dat or anything else.
Lean to use dput()

I needed to use these commands to read this irregularly dispaly list  
of numbers:
:

dat <- scan()
mat <- matrix(dat, ncol=3, byrow=TRUE)
datf <- as.data.frame(mat)
names(datf) <- c("index", "Contrast_log_FTL","Contrast_Log_MTL")
#
Dear Cat

My apologies for presuming...

Here's a "primitive" solution:  compute a t-statistic or CI.

t = (beta-hat - 1)/SE(beta-hat), compare to qt(.975, res.df)

Or Better, compute the 95% confidence interval

   beta-hat + c(-1,1)*qt(.975, res.df)*SE(beta-hat)

albyn
On 2012-11-24 18:05, Catriona Hendry wrote:
#
BTW that plot is ridiculous. You should be plotting using the  
coefficients from the non-offset model, since that is the real data  
model.
On Nov 24, 2012, at 6:05 PM, Catriona Hendry wrote:

            
David Winsemius, MD
Alameda, CA, USA
#
At 02:05 25/11/2012, Catriona Hendry wrote:
Cat,
What did you think the call to abline was going to do? Did you mean 
to use the reg parameter?

But really Bert's advice dominates any other here, is this really, 
really what you want to do?
Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html