[R] Comparing linear regression coefficients to a slope of 1

Michael Dewey info at aghmed.fsnet.co.uk
Sun Nov 25 13:14:42 CET 2012


At 02:05 25/11/2012, Catriona Hendry wrote:
>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:

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?



> >plot(Contrast_log_MTL_ALL, Contrast_log_FTL_ALL)
>
> >Regression_PhyloContrasts_ALL <- lm(Contrast_log_FTL_ALL ~
>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:
>
> > 1. The model is correct :  lm( y~ x + offset(x))
> > ( AFAICS)
> >
> > 2. Read the posting guide, please: Code? I do not know what you mean by:
> >
> > " this resulted in a regression line that was plotted perpendicular to
> > the data when added with the abline function."
> >
> > Of course, maybe someone else will groc this.
> >
> > 3. I wonder if you really want to do what you are doing, anyway. For
> > example, in comparing two assays to see whether they give "similar"
> > results, you would **not** do what you are doing. If you care to follow up
> > on this, I suggest you post complete context to a statistical mailing list,
> > not here, like stats.stackexchange .com.  Also, feel free to ignore me, of
> > course. I'm just guessing.
> >
> > Cheers,
> > Bert
> >
> > Cheers,
> > Bert
> >
> >
> > On Sat, Nov 24, 2012 at 4:27 PM, Catriona Hendry 
> <hendry at gwmail.gwu.edu>wrote:
> >
> >> Hi!
> >>
> >> I have a question that is probably very basic, but I cannot figure out how
> >> to do it. I simply need to compare the significance of a regression slope
> >> against a slope of 1, instead of the default of zero.
> >>
> >> I know this topic has been posted before, and I have tried to use the
> >> advice given to others to fix my problem. I tried the offset command based
> >> on one of these advice threads as follows:
> >>
> >> Regression <- lm(y~x+offset(1*x))
> >>
> >> but this resulted in a regression line that was plotted perpendicular to
> >> the data when added with the abline function.
> >>
> >> I would be extremely grateful for your help!!
> >>
> >> Thanks!!
> >>
> >> Cat
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> >
> > --
> >
> > Bert Gunter
> > Genentech Nonclinical Biostatistics
> >
> > Internal Contact Info:
> > Phone: 467-7374
> > Website:
> >
> > 
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
> >
> >
> >
>
>
>--
>-----------------------------------------
>*Catriona Hendry*
>*Postgraduate Student*
>*Biological Sciences Department*
>*George Washington University*
>*hendry at gwmail.gwu.edu*
>
>Content-Type: image/png; name="regression error.png"
>Content-Disposition: attachment; filename="regression error.png"
>X-Attachment-Id: f_h9xixz060

Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html




More information about the R-help mailing list