Estimate linear combinations from a regression model
estimate.Rd
Estimate linear combinations from a regression model
Usage
estimate(fit, lambda, alpha = 0.05, t.test = inherits(fit, "lm"), trans)
Arguments
- fit
- lambda
Linear combination weights (numeric vector with length equal to number of coefficients in fit)
- alpha
Error rate for confidence interval (default: 0.05)
- t.test
Use t distribution for inference? (default: TRUE only if model is linear)
- trans
Apply a transformation function to the results? (function)
Examples
# Linear regression
fit <- lm(Ozone ~ Wind + Temp + Solar.R, airquality)
estimate(fit, c(0, 1, -1, 5))
#> Estimate Lower Upper SE t
#> -4.686581e+00 -5.871574e+00 -3.501589e+00 5.977614e-01 -7.840221e+00
#> p
#> 3.561935e-12
# Logistic regression
DF <- as.data.frame(Titanic)
DF <- DF[rep(1:nrow(DF), DF$Freq),]
fit <- glm(Survived ~ Class + Sex + Age, DF, family=binomial)
estimate(fit, c(0, 1, -1, 0, 0, 0), trans=exp)
#> Estimate Lower Upper SE t p
#> 2.137565e+00 1.512603e+00 3.020742e+00 NA 4.307663e+00 1.722593e-05