The variables used are:
- A: a dummy variable (1 = bid offer accepted)
- bid: a positive discrete variable (the bid offer)
- income
- du_owner: 1 = house ownership 

The script is the following:

list X = income du_owner

...............................

#bootstrapped confidence intervals
genr sel = ok(A bid X)
smpl sel --restrict
store temp.gdt A bid X --overwrite 
open temp.gdt --quiet

n = $nobs
list X = dataset - A - bid

loop 5000 --progressive
        dataset resample n
    
        #logit regression
        logit A const bid X --quiet
    
        #mean and median Willingness-To-Pay
        matrix x = {X}
        scalar mean_wtp = -($coeff(const)+(meanc(x)*$coeff[3:
$ncoeff]))/$coeff(bid)
        scalar median_wtp = -($coeff(const)+(quantile(x,0.5)*$coeff[3:
$ncoeff]))/$coeff(bid)

        #printing stats
        print mean_wtp median_wtp
        #save the coefficients
        store wtp.gdt mean_wtp median_wtp
        smpl full
endloop

This does not raise any issue, because I managed to remove all the
nested loops.
These loops were in a previous version I deleted, but I replicated the
problem simply adding a (now useless) loop in the new code:

loop 5000 --progressive
        dataset resample n
    
        #logit regression
        logit A const bid X --quiet
    
        #mean and median Willingness-To-Pay
        matrix x = {X}
        scalar mean_wtp = - ($coeff(const)+(meanc(x)*$coeff[3:
$ncoeff]))/$coeff(bid)
        scalar median_wtp = - ($coeff(const)+(quantile(x,0.5)*$coeff[3:
$ncoeff]))/$coeff(bid)

        #USELESS NESTED LOOP....
        o = rows(x)
        loop for i = 1...o --quiet
                series s = 0
        endloop

        #printing stats on these
        print mean_wtp median_wtp
        #save the coefficients to file
        store wtp.gdt mean_wtp median_wtp
        smpl full
endloop

The useless loop causes the program to crash.
Let me know if you need more information or the original db

See you
Giuseppe

On Sun, 2011-01-16 at 09:17 -0500, Allin Cottrell wrote:
> On Sun, 16 Jan 2011, Giuseppe Vittucci wrote:
> 
> > I use Gretl 1.9.3 running on Ubuntu 10.04.
> > To calculate some bootstrapped confidence intervals with pairs bootstrap
> > I used the loop in progressive mode and the "dataset resample" command.
> >
> > All works fine if I do not use (simple) loops nested in the first one.
> > When instead I do that, Gretl unexpectedly quits with a "Segmentation
> > fault" error.
> 
> It's possible that the problem you've found is fixed in CVS. If
> you could send me a copy of the script you're using I'll run some
> tests. Thanks.
> 
> Allin Cottrell
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users


Reply via email to