lincon | R Documentation |
This is a function allows one to obtain standard inferences (i.e., point estimates, standard errors, confidence intervals, etc.) concerning any linear combination of regression model parameters.
## S3 method for class 'lm'
lincon(model, a, b, df, tf, cnames, level = 0.95, fcov = vcov, ...)
## S3 method for class 'nls'
lincon(model, a, b, df, tf, cnames, level = 0.95, fcov = vcov, ...)
## S3 method for class 'glm'
lincon(model, a, b, df, tf, cnames, level = 0.95, fcov = vcov, ...)
## S3 method for class 'lmerMod'
lincon(model, a, b, df, tf, cnames, level = 0.95, fcov = vcov, ...)
## S3 method for class 'glmerMod'
lincon(model, a, b, df, tf, cnames, level = 0.95, fcov = vcov, ...)
## S3 method for class 'gls'
lincon(model, a, b, df, tf, cnames, level = 0.95, fcov = vcov, ...)
## Default S3 method:
lincon(model, a, b, df = Inf, tf, cnames, level = 0.95, fcov = vcov, fest = coef, ...)
model |
Model object. |
... |
Not used. |
a |
Vector or matrix defining the |
b |
A scalar or vector defining the |
df |
Optional degrees of freedom. If left missing the residual degrees of freedom will be used except for GLMs with |
tf |
Optional transformation function to apply to the point estimate(s) and confidence interval limits (e.g., |
cnames |
Optional vector of contrast names. If left missing the contrast coefficients are shown. If FALSE then no names are shown. |
level |
Confidence level in (0,1). Default is 0.95. |
fcov |
Function for estimating the covariance matrix of the model parameters. |
fest |
Function for extracting the model parameter estimates (must be same as order of the covariance matrix). |
For a regression model with a linear component (e.g., linear and generalized linear models) with parameters \beta_0, \beta_1, \dots, \beta_p
a linear combination is defined as
a_0\beta_0 + a_1\beta_1 + \cdots + a_p\beta_p + b.
For a nonlinear regression model with parameters \theta_1, \theta_2, \dots, \theta_q
a linear combination is defined as
a_1\theta_1 + a_2\theta_2 + \cdots + a_q\theta_q + b.
Inferences for the linear combination are based on either exact (normal theory) or Wald (asymptotic) test statistics and confidence intervals. The estimated standard error(s) of the linear combinations are computed using any specified function for estimating the variance-covariance matrix of the model parameters.
myreg <- lm(Gas ~ Insul + Temp + Insul:Temp, data = MASS::whiteside)
# same as summary(myreg)
lincon(myreg)
# slope with respect to temperature after insulation
lincon(myreg, a = c(0,0,1,1))
# expected gas consumption before and after insulation at 5 degrees celsius
lincon(myreg, a = matrix(c(1,0,5,0,1,1,5,5), 2, 4, byrow = TRUE), cnames = c("Before","After"))
# change in expected gas consumption at five degrees celsius from adding insulation
lincon(myreg, a = c(0,1,0,5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.