I have the logistic regression of the form
where
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
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.
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.