inst/doc/htobit-md.R

## ----preliminaries, echo = FALSE, message = FALSE, results = "hide"------
library("htobit2018")
library("car")
library("crch")
library("lmtest")
library("memisc")

## ----verbeek-------------------------------------------------------------
data("AlcoholTobacco", package = "htobit2018")
library("htobit2018")
ma <- htobit(alcohol ~ (age + adults) * log(expenditure) + oldkids + youngkids, data = AlcoholTobacco)
summary(ma)

## ----restrictions--------------------------------------------------------
library("car")
linearHypothesis(ma, "oldkids = youngkids")
linearHypothesis(ma, "oldkids = adults")

## ----alternative---------------------------------------------------------
AlcoholTobacco$persons <- with(AlcoholTobacco, adults + oldkids + youngkids)
ma2 <- htobit(alcohol ~ (age + adults) * log(expenditure) + oldkids + youngkids |
  (age + adults) * log(expenditure) + oldkids + youngkids, data = AlcoholTobacco)
ma3 <- htobit(alcohol ~ age + log(expenditure) + persons | age + log(expenditure) + persons, data = AlcoholTobacco)
BIC(ma, ma2, ma3)

## ----lrtest--------------------------------------------------------------
library("lmtest")
lrtest(ma, ma2, ma3)

## ----crch----------------------------------------------------------------
library("crch")
ca3 <- crch(alcohol ~ age + log(expenditure) + persons | age + log(expenditure) + persons,
  data = AlcoholTobacco, left = 0)

## ----mtable--------------------------------------------------------------
library("memisc")
mtable("htobit" = ma3, "crch" = ca3)

Try the htobit2018 package in your browser

Any scripts or data that you put into this service are public.

htobit2018 documentation built on May 24, 2019, 3:01 a.m.