2

I have the logistic regression of the form

Y=f(X;\theta)=\alpha+\beta X

where

\theta={\alpha,\beta}

The corresponding R code is the following.

Regression_hat<-glm(Y~X,family=binomial(link='logit'))

I know that in order to test the joint hypothesis test H_{0}:\hat{\alpha}=0 \; \& \; \hat{\beta}=0

the linearHypothesis test can be used with the following form:

linearHypothesis(Regression_hat,c("(Intercept)=0","X=0"),test=c("F"))

I would like to test (jointly) the hypothesis that both estimated parameters equal to two arbitrary values respectively. These two values are stored under different variable (e.g V1 and V2) names in R although using variable names in the above code (linearHypothesis(Regression_hat,c("(Intercept)=V1","X=V2"),test=c("F"))) does not work.

Whitebeard13
  • 411
  • 1
  • 7
  • 17

1 Answers1

1

Try

linearHypothesis(Regression_hat, paste(c("(Intercept)", "X"), "=", c(V1, V2)), test = "F")

The issue is that writing, e.g., "X=V2" doesn't make X2 look like a variable; it's just a part of this character. Using paste helps you to construct, e.g., "X=3" when V1 takes value 3.

Julius Vainora
  • 47,421
  • 9
  • 90
  • 102