[R] Testing general hypotheses on regression coefficients

Greg Snow 538280 at gmail.com
Mon Sep 8 18:46:34 CEST 2014


Others have discussed some of the theoretical approaches (delta
method), but as has also been pointed out, this is a mailing list
about R, not theory, so here are some approaches to your question from
the approach of those of us who like programming R more than
remembering theory.

I assume that one reason you may be interested in B2/B1 is that you
want the confidence interval on the quantity, not just the test of
whether it is 0 (that test being equivalent to B2=0 unless B1 is
exactly equal to 0).  So I will focus more on confidence intervals
(which you can use as tests by seeing if the null value is in the
interval/region or not).

Approach 1, simulation:

If all the assumptions hold for the linear regression, then the
parameter estimates are considered to by multivariate normal.  You can
get the covariance matrix for this normal using the vcov function on
the summary of your fitted object.  Now you can use the mvrnorm
function with the estimated means and covariance to generate a bunch
of observations from this multivariate normal and compute B2/B1 or
some combination of B2/B1 and B4/B3 for each observation.  These
values represent the distribution of interest and you can calculate a
confidence interval by finding the quantiles of the values (0.025 and
0.975 for 95%) or finding the HPD interval (minimum width interval),
the emp.hpd function in the TeachingDemos package is one way to do
this.  For your second hypothesis you could look at B2/B1 - B4/B3 = 0
or (B2/B1) / (B4/B3) = 1, or create a joint confidence region on the 2
ratios and see if the x=y line intersects that region.

Approach 2, bootstrap:

Bootstrap the whole process, fit the regression model then find the
ratio of the estimates.  Find the bootstrap confidence interval of the
ratio(s), follow above advice.

Approach 3, Bayes:

Fit a Bayesian regression model and look at the posterior distribution
of the ratio(s) of interest, calculate the credible interval/region
(the steps will be similar to the previous approaches).

Approach 4, simulate from the null:

Fit your regression model under then null hypothesis of interest being
true (for a more complicated null, your second, you may need to use
optimization or quadratic programming to allow some values to vary,
but have others dependent on those, then find the least squares
solution).  Now simulate data based on that model, fit the full
regression to the simulated data sets and compare the parameter
estimates (or ratios thereof) to the parameter estimates from the
original data.


You could try any of these approaches for hypotheses where traditional
linear hypotheses work and compare the results from the traditional
approach to the above approaches to see how they compare (and how many
iterations/samples you will need).

On Fri, Sep 5, 2014 at 8:17 PM, Chris <bonsxanco at yahoo.com> wrote:
> Hi.
>
> Say I have a model like
>
> y = a + B1*x1 + B2*x2 + B3*x3 + B4*x4 + e
>
> and I want to test
>
> H0: B2/B1 = 0
>
> or
>
> H0: B2/B1=B4/B3
>
> (whatever H1). How can I proceed?
>
> I now about car::linearHypothesis, but I can't figure out a way to do the
> tests above.
>
> Any hint?
>
> Thanks.
>
> C
>
> ______________________________________________
> 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list