Version: | 0.3-3 |
Date: | 2020-10-09 |
Title: | Heteroscedastic t-Regression |
Author: | Julian Taylor <julian.taylor@adelaide.edu.au> |
Maintainer: | Julian Taylor <julian.taylor@adelaide.edu.au> |
Depends: | R (≥ 2.0.0), MASS, lattice |
Description: | Functions for the fitting and summarizing of heteroscedastic t-regression. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
NeedsCompilation: | no |
Packaged: | 2020-10-09 02:40:18 UTC; a1066967 |
Repository: | CRAN |
Date/Publication: | 2020-10-13 10:50:02 UTC |
Internal profile likelihood function
Description
These are internal hett
functions that are not intended to be
directly called by the user
Usage
dof.profile(dof, n, sqResid, orthoI, X, Z)
Author(s)
Julian Taylor
Excess returns for Martin Marietta company
Description
Data from the Martin Marietta company collected overa period of 5 years on a monthly basis
Usage
data(mm)
Format
A data frame with 60 observations on the following 4 variables.
- date
the month the data was collected
- am.can
a numeric vector
- m.marietta
excess returns from the Martin Marietta company
- CRSP
an index for the excess rate returns for the New York stock exchange
Source
Bulter et al (1990). Robust and partly adpative estimation of regression models. Review of Economic Statistics, 72, 321-327.
Examples
data(mm, package = "hett")
attach(mm)
plot(CRSP, m.marietta)
lines(CRSP, fitted(lm(m.marietta ~ CRSP)), lty = 2)
Rent for Land PLanted to Alfalfa
Description
Dataset collected in 1977 from Minnesota to study the variation in land rented for growing alfalfa
Usage
data(rent)
Format
A data frame with 67 observations on the following 5 variables.
- Rent
a numeric vector average rent per acre.
- AllRent
a numeric vector describing average rent paid for all tillable land.
- Cows
a numeric vector describing the density of dairy cows (number per square mile).
- Pasture
a numeric vector describing the proportion of farmland used as pasture.
- Liming
a factor with levels
No
if no liming is required to grow alfalfa andYes
if it does.
Source
Weisberg, S (1985). Applied Linear Regression Wiley: New York
Examples
library(lattice)
data(rent, package = "hett")
attach(rent)
xyplot(log(Rent/AllRent) ~ sqrt(Cows), groups = Liming, panel = panel.superpose)
summary method for class "tlm"
Description
Summarizes the heteroscedastic t regression object
Usage
## S3 method for class 'tlm'
summary(object, correlation = FALSE, ...)
## S3 method for class 'summary.tlm'
print(x, ...)
Arguments
object |
heteroscedastic t regression object called from |
x |
an object of class " |
correlation |
should the calaculation of the parameter correlation matrix be
supressed. If the fit includes a location and a scale formula then both
correlation matrices are printed. The default is |
... |
arguments passed to or from other methods |
Details
The table summary produced by this function should be used with
caution. A more appropriate test between nested models is to use the
score statistic function tscore
.
Value
a list containing the following components:
loc.summary |
an object containing a list of objects that summarize the location model |
scale.summary |
an object containing a list of objects that summarize the scale model |
iter |
the number of iterations of the algorithm |
dof |
value of the fixed or estimated degrees of freedom |
dofse |
the standard error associated with the degrees of freedom if estimated |
logLik |
the maximised log-likelihood |
method |
the method used to maximize the likelihood |
endTime |
the time taken for the algorithm to converge |
Author(s)
Julian Taylor
See Also
Examples
data(mm, package = "hett")
attach(mm)
## fit a model with heteroscedasticity and estimating the degrees of freedom
tfit2 <- tlm(m.marietta ~ CRSP, ~ CRSP, data = mm, start = list(dof =
3), estDof = TRUE)
summary(tfit2)
Maximum likelihood estimation for heteroscedastic t regression
Description
Fits a heteroscedastic t regression to given data for known and unknown degrees of freedom.
Usage
tlm(lform, sform = ~ 1, data = NULL, subset = NULL, contrasts =
NULL, na.action = na.fail, start = NULL, control = tlm.control(...),
obs = FALSE, estDof = FALSE, ... )
## S3 method for class 'tlm'
print(x, ...)
Arguments
x |
an object of class " |
lform |
a formula of the type |
sform |
a formula of the type |
data |
the data in the form of a |
subset |
numerical vector to subset the |
contrasts |
set of contrasts for the location model (see |
na.action |
the action to proceed with in the event of |
start |
is a list of possibly four named components, (" |
control |
is an argument to a function that maintains the control of the
algorithm. The |
obs |
should the location parameters be calculated using the observed or
expected information(default = |
estDof |
should the degrees of freedom parameter be estimated or not. If |
... |
arguments passed to |
Details
When the degrees of freedom is unknown the code uses the non-linear optimiser
nlm
. If the response (and therefore the errors) is tending toward
a Gaussian this optimisation will still converge but with with very high degrees of freedom.
To obtain the appropriate standard errors from summary
the user
must specify the argument obs = F
to ensure that the location
parameter is calculated using the expected information.
Value
a list containing the following components:
loc.fit |
an object containing the estimated location parameters and other elements associated with the location parameter model |
scale.fit |
an object containing the estimated scale parameters and other elements associated with the scale parameter model |
random |
the random scale effects |
dof |
fixed or estimated degrees of freedom |
dofse |
the standard error associated with the degrees of freedom |
iter |
the number of iterations of the algorithm |
logLik |
the maximised log-likelihood |
endTime |
the time taken for the algorithm to converge |
Background
The theoretical background for this function can be found in Taylor and Verbyla (2004).
Author(s)
Julian Taylor
References
Taylor, J. D. & Verbyla, A. P (2004). Joint modelling of the location and scale parameters of the t-distribution. Statistical Modelling 4, 91-112.
See Also
Examples
data(mm, package = "hett")
attach(mm)
## fit a model with no heteroscedasticity and fixed degrees of freedom
tfit <- tlm(m.marietta ~ CRSP, data = mm, start = list(dof = 3))
## fit a model with heteroscedasticity and fixed degrees of freedom
tfit1 <- tlm(m.marietta ~ CRSP, ~ CRSP, data = mm, start = list(dof = 3))
## fit a model with heteroscedasticity and estimating the degrees of freedom
tfit2 <- tlm(m.marietta ~ CRSP, ~ CRSP, data = mm,
start = list(dof = 3), estDof = TRUE)
Auxiliary for Controlling tlm Fitting
Description
Auxiliary function for fitting tlm
model. Generally only used
when calling tlm
Usage
tlm.control(epsilon = 1e-07, maxit = 50, trace = FALSE, verboseLev = 1)
Arguments
epsilon |
positive convergence tolerance value. The iterations converge when [newlik - oldlik] < epsilon/2 |
maxit |
integer giving the maximum iterations allowable for the routine |
trace |
logical. If |
verboseLev |
integer. If 1 then print according to |
Value
A list with the argument as values
Author(s)
Julian Taylor
See Also
Examples
data(mm, package = "hett")
attach(mm)
## change the maximum amount of iterations for the algorithm
fit1 <- tlm(m.marietta ~ CRSP, ~ 1, data = mm, start = list(dof = 3),
estDof = TRUE, control = tlm.control(maxit = 100))
Score test for heteroscedastic t models
Description
Provides a score test for the location and scale parameters of the heteroscedastic t regression model.
Usage
tscore(..., data = NULL, scale = FALSE)
Arguments
... |
Any number of arguments containing nested model fits from |
data |
the data used to fit the models involved |
scale |
logical. If |
Details
The user must supply nested models that test, either, the scale or the location component of the model. The model objects must be nested from left to right. Currently there are no traps if the arguments are not given in this order.
The models must also have either, all fixed degrees of freedom or estimated degrees of freedom.
Value
Output containing the hypothesis, the score statistic, degrees of freedom for the test and the p-value are printed to the screen.
Author(s)
Julian Taylor
References
Taylor, J. D. & Verbyla, A. P (2004). Joint modelling of the location and scale parameters of the t-distribution. Statistical Modelling 4, 91-112.
See Also
Examples
data(mm, package = "hett")
attach(mm)
tfit1 <- tlm(m.marietta ~ CRSP, ~ 1, data = mm, start = list(dof = 3),
estDof = TRUE)
tfit2 <- tlm(m.marietta ~ CRSP, ~ CRSP, data = mm, start = list(dof =
3), estDof = TRUE)
tscore(tfit1, tfit2, data = mm, scale = TRUE)
Summary function for the scale or location component of a heteroscedastic t model
Description
Summarizes the location or scale components of a heteroscedastic t model
Usage
tsum(object, dispersion = NULL, correlation = FALSE,
symbolic.cor = FALSE, ...)
## S3 method for class 'tsum'
print(x, digits = max(3, getOption("digits") - 3), symbolic.cor =
x$symbolic.cor, signif.stars = getOption("show.signif.stars"),
scale = TRUE, ...)
Arguments
object |
either the location or scale object created by fitting
a heteroscedastic t object with |
x |
an object of class " |
dispersion |
1 if summarizing the location model; 2 if summarizing the scale model (see Details) |
correlation |
logical; if |
digits |
the number of significant digits to be printed. |
symbolic.cor |
logical. If |
signif.stars |
logical. if |
scale |
logical. If |
... |
further arguments passed to or from other methods. |
Details
The argument supplied to dispersion
must be either 1
(location model) or 2 (scale model). The reason for this is because
the fitting of the model has already
scaled the covariance matrix for the location coefficients. Hence the
scaled and unscaled versions of covariance matrix for the location
model are identical.
This function will not be generally called by the user as it
will only summarize the location or scale model but not both. Instead
the user should refer to summary.tlm
to print a summary of both models.
Value
tsum
returns an object of class "tsum
", a list
with components
call |
the component from |
df.residual |
the component from |
coefficients |
the matrix of coefficients, standard errors, z-values and p-values |
dispersion |
the supplied dispersion argument |
df |
a 2-vector of the rank of the model and the number of residual degrees of freedom |
cov.unscaled |
the unscaled ( |
cov.scaled |
ditto, scaled by |
correlation |
(only if |
symbolic.cor |
(only if |
Author(s)
Julian Taylor
See Also
Examples
data(mm, package = "hett")
attach(mm)
tfit <- tlm(m.marietta ~ CRSP, ~ CRSP, data = mm, start = list(dof = 3),
estDof = TRUE)
tsum(tfit$loc.fit, dispersion = 1)