R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("hett-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('hett') Loading required package: MASS > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "mm" > > ### * mm > > flush(stderr()); flush(stdout()) > > ### Name: mm > ### Title: Excess returns for Martin Marietta company > ### Aliases: mm > ### Keywords: datasets > > ### ** Examples > > > data(mm, package = "hett") > attach(mm) > plot(CRSP, m.marietta) > lines(CRSP, fitted(lm(m.marietta ~ CRSP)), lty = 2) > > > > > cleanEx(); ..nameEx <- "rent" > > ### * rent > > flush(stderr()); flush(stdout()) > > ### Name: rent > ### Title: Rent for Land PLanted to Alfalfa > ### Aliases: rent > ### Keywords: datasets > > ### ** Examples > > > library(lattice) > data(rent, package = "hett") > attach(rent) > xyplot(log(Rent/AllRent) ~ sqrt(Cows), groups = Liming, panel = panel.superpose) > > > > > cleanEx(); ..nameEx <- "summary.tlm" > > ### * summary.tlm > > flush(stderr()); flush(stdout()) > > ### Name: summary.tlm > ### Title: summary method for class "tlm" > ### Aliases: summary.tlm print.summary.tlm > ### Keywords: regression distribution > > ### ** 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) Location model : Call: tlm(lform = m.marietta ~ CRSP, sform = ~CRSP, data = mm, start = list(dof = 3), estDof = TRUE) Residuals: Min 1Q Median 3Q Max -0.140312 -0.036664 0.001882 0.040712 0.552411 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.006437 0.008096 -0.795 0.43 CRSP 1.206854 0.205935 5.860 2.31e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Scale parameter(s) as estimated below) Scale Model : Call: tlm(lform = m.marietta ~ CRSP, sform = ~CRSP, data = mm, start = list(dof = 3), estDof = TRUE) Residuals: Min 1Q Median 3Q Max -1.7981 -1.4570 -0.7495 0.8865 5.6503 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -5.9595 0.2501 -23.828 <2e-16 *** CRSP 13.1206 5.8234 2.253 0.0243 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Scale parameter taken to be 2 ) Est. degrees of freedom parameter: 3.758674 Standard error for d.o.f: 1.915372 No. of iterations of model : 10 in 0.19 Heteroscedastic t Likelihood : 73.3702 > > > > cleanEx(); ..nameEx <- "tlm" > > ### * tlm > > flush(stderr()); flush(stdout()) > > ### Name: tlm > ### Title: Maximum likelihood estimation for heteroscedastic t regression > ### Aliases: tlm print.tlm > ### Keywords: regression distribution > > ### ** 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) > > > > cleanEx(); ..nameEx <- "tlm.control" > > ### * tlm.control > > flush(stderr()); flush(stdout()) > > ### Name: tlm.control > ### Title: Auxiliary for Controlling tlm Fitting > ### Aliases: tlm.control > ### Keywords: regression distribution > > ### ** 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)) > > > > > cleanEx(); ..nameEx <- "tscore" > > ### * tscore > > flush(stderr()); flush(stdout()) > > ### Name: tscore > ### Title: Score test for heteroscedastic t models > ### Aliases: tscore > ### Keywords: regression distribution > > ### ** 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) Heteroscedastic t Regression: Scale score statistic tests: df Score Stat. P-value 1 vs CRSP 1.0000 2.2685 0.132 > > > > cleanEx(); ..nameEx <- "tsum" > > ### * tsum > > flush(stderr()); flush(stdout()) > > ### Name: tsum > ### Title: Summary function for the scale or location component of a > ### heteroscedastic t model > ### Aliases: tsum print.tsum > ### Keywords: regression distribution > > ### ** 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) Call: tlm(lform = m.marietta ~ CRSP, sform = ~CRSP, data = mm, start = list(dof = 3), estDof = TRUE) Residuals: Min 1Q Median 3Q Max -0.140312 -0.036664 0.001882 0.040712 0.552411 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.006437 0.008096 -0.795 0.43 CRSP 1.206854 0.205935 5.860 2.31e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Scale parameter taken to be 1 ) > > > > ### *