Doesn't the p-value from using offset work for you?  if you really
need a p-value.  The confint method is a quick and easy way to see if
it is significantly different from 1 (see Rolf's response), but does
not provide an exact p-value.  I guess you could do confidence
intervals at different confidence levels until you find the level such
that one of the limits is close enough to 1, but that seems like way
to much work.  You could also compute the p-value by taking the slope
minus 1 divided by the standard error and plug that into the pt
function with the correct degrees of freedom.  You could even write a
function to do that for you, but it still seems more work than adding
the offset to the formula.

On Tue, Apr 24, 2012 at 8:17 AM, Mark Na <mtb...@gmail.com> wrote:
> Hi Greg. Thanks for your reply. Do you know if there is a way to use the
> confint function to get a p-value on this test?
>
> Thanks, Mark
>
>
>
> On Mon, Apr 23, 2012 at 3:10 PM, Greg Snow <538...@gmail.com> wrote:
>>
>> One option is to subtract the continuous variable from y before doing
>> the regression (this works with any regression package/function).  The
>> probably better way in R is to use the 'offset' function:
>>
>> formula = I(log(data$AB.obs + 1, 10)-log(data$SIZE,10)) ~
>> log(data$SIZE, 10) + data$Y
>> formula = log(data$AB.obs + 1) ~ offset( log(data$SIZE,10) ) +
>> log(data$SIZE,10) + data$Y
>>
>> Or you can use a function like 'confint' to find the confidence
>> interval for the slope and see if 1 is in the interval.
>>
>> On Mon, Apr 23, 2012 at 12:11 PM, Mark Na <mtb...@gmail.com> wrote:
>> > Dear R-helpers,
>> >
>> > I would like to test if the slope corresponding to a continuous variable
>> > in
>> > my model (summary below) is different than one.
>> >
>> > I would appreciate any ideas for how I could do this in R, after having
>> > specified and run this model?
>> >
>> > Many thanks,
>> >
>> > Mark Na
>> >
>> >
>> >
>> > Call:
>> > lm(formula = log(data$AB.obs + 1, 10) ~ log(data$SIZE, 10) +
>> >   data$Y)
>> >
>> > Residuals:
>> >    Min       1Q   Median       3Q      Max
>> > -0.94368 -0.13870  0.04398  0.17825  0.63365
>> >
>> > Coefficients:
>> >                  Estimate Std. Error t value  Pr(>|t|)
>> > (Intercept)        -1.18282    0.09120 -12.970   < 2e-16 ***
>> > log(data$SIZE, 10)  0.56009    0.02564  21.846   < 2e-16 ***
>> > data$Y2008          0.16825    0.04366   3.854  0.000151 ***
>> > data$Y2009          0.20310    0.04707   4.315 0.0000238 ***
>> > ---
>> > Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>> >
>> > Residual standard error: 0.2793 on 228 degrees of freedom
>> > Multiple R-squared: 0.6768,     Adjusted R-squared: 0.6726
>> > F-statistic: 159.2 on 3 and 228 DF,  p-value: < 2.2e-16
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> >
>> > ______________________________________________
>> > R-help@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.
>> >
>>
>>
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> 538...@gmail.com
>
>



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

______________________________________________
R-help@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.

Reply via email to