File: wtp.inp

package info (click to toggle)
gretl 2022c-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,552 kB
  • sloc: ansic: 409,074; sh: 4,449; makefile: 3,222; cpp: 2,777; xml: 599; perl: 364
file content (35 lines) | stat: -rw-r--r-- 725 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Interval regression: Verbeek's "willingness to pay" example
set echo off
set messages off
open wtp.gdt --quiet

# construct the two bounds variables
series lo = NA
series hi = NA

smpl depvar == 1 --restrict
hi = bidl
smpl depvar == 2 --restrict --replace
lo = bidl
hi = bid1
smpl depvar == 3 --restrict --replace
lo = bid1
hi = bidh
smpl depvar == 4 --restrict --replace
lo = bidh

/*
 Re-establish the full sample range and run two variants
 of interval regression; a likelihood-ratio test is also
 computed.
*/

smpl full
intreg lo hi const
scalar ll0 = $lnl
intreg lo hi const age female income
scalar ll1 = $lnl
scalar LR = 2*(ll1 - ll0)
printf "LR test: Chi-square(3) = %g, p-value = %g\n", \
  LR, pvalue(X, 3, LR)