title: t.test in R. Hypothesis testing for one coefficient, but you have a multiple regression
body: <p>I have a regression like this y = β0 + β1xi1 + β2xi2 + ui.
  And I want to perform a two sided t test that β1=3, 5% confidence</p>
  <p>So according to examples I've found, I think I should do something like this:
  <code>t.test(y~x1, data=data, alternative=c(&quot;two.sided&quot;), mu=3, conf.level=0.95, var.eq=F, paired=F)</code></p>
  <p>But I'm wondering, how does this take into account that the regression I'm doing includes both x1 and x2?  Surely the coefficient will be different when both are added so the first line of code is wrong.  But adding it in like this <code>t.test(y~x1+x2, data=data, alternative=c(&quot;two.sided&quot;), mu=3, conf.level=0.95, var.eq=F, paired=F)</code> doesn't work.</p>
  <p>Thanks</p>