Garrett Fox
2005-Jul-26 22:37 UTC
[R] Difficulty getting standard deviation of ALL odds ratios with glm function, logistic regression, need cov of parameters
I am trying to do logistic regression with a categorical predictor variable with the glm() function, family=binomial. Using glm() I would like to be able to calculate the confidence intervals of all three possible odds ratios for a factor (the factor has three categories). Three categories imply two columns of 0's and 1's in the design matrix, and two parameter estimates with their SE's. Two confidence intervals for odds ratios can be easily calculated, the third confidence interval can be calculated if I know the SE of B1-B2, but this requires the covariance matrix of parameter estimates, which is not given to my knowledge. My initial thought was that Cov(B1,B2)=0, but this cannot be true or the variance estimates would depend on how you set up the design matrix (the factor symbolized by 0,0 would always have a higher SD). Please help me find the covariance of the parameter estimates. Thank you in advance, Garrett Fox
Thomas Lumley
2005-Jul-26 22:53 UTC
[R] Difficulty getting standard deviation of ALL odds ratios with glm function, logistic regression, need cov of parameters
On Tue, 26 Jul 2005, Garrett Fox wrote:> I am trying to do logistic regression with a categorical predictor variable > with the glm() function, family=binomial. Using glm() I would like to be > able to calculate the confidence intervals of all three possible odds ratios > for a factor (the factor has three categories). Three categories imply two > columns of 0's and 1's in the design matrix, and two parameter estimates > with their SE's. Two confidence intervals for odds ratios can be easily > calculated, the third confidence interval can be calculated if I know the SE > of B1-B2, but this requires the covariance matrix of parameter estimates, > which is not given to my knowledge. >vcov(your.model) returns the variance-covariance matrix. -thomas