Thanks, Arne!

But I'm having another problem now. When I transform my data into a
pdata.frame form and try to run a tobit model with random effects I get an
error. Below I provide the head of my data, the code I used and the error
message. Any help?

> head(pdata)
                                   X   X.1 year mun.cod uf.cod uf.name
mun.name       uf.mun
ACACRELANDIA-2003  ACACRELANDIA-2003     1 2003 1200013     12      AC
ACRELANDIA  ACACRELANDIA
ACACRELANDIA-2004    CEIBIAPINA-2003  5561 2004 1200013     12      AC
ACRELANDIA  ACACRELANDIA
ACACRELANDIA-2005     MGARACUAI-2007 11121 2005 1200013     12      AC
ACRELANDIA  ACACRELANDIA
ACACRELANDIA-2006 MGSAO GERALDO-2006 16681 2006 1200013     12      AC
ACRELANDIA  ACACRELANDIA
ACACRELANDIA-2007 PBSERTAOZINHO-2005 22241 2007 1200013     12      AC
ACRELANDIA  ACACRELANDIA
ACACRELANDIA-2008        PRPIEN-2008 27801 2008 1200013     12      AC
ACRELANDIA  ACACRELANDIA
                  transfers populat agric.pib indust.pib servic.pib  apu.pib
 tax.pib       pib
ACACRELANDIA-2003       920    8695  31744.92   5292.439   26942.19 15955.14
4527.178  68506.73
ACACRELANDIA-2004         0   10668  48947.97   9353.529   33134.56 19922.54
5825.801  97261.86
ACACRELANDIA-2005     49287   11451  56291.90  11214.051   39326.32 23340.46
7661.003 114493.30
ACACRELANDIA-2006    385000   11786  55290.26  11976.119   46405.99 27401.64
7730.059 121402.40
ACACRELANDIA-2007   1599730   11520  68478.03  15526.679   54555.67 31382.93
7550.055 146110.40
ACACRELANDIA-2008   1295000   11987  61736.50  12812.245   63688.96 37518.87
7824.615 146062.30
                  bol.fam      ifdm mayor.party mayor.num
  mayor.name mayor.vot
ACACRELANDIA-2003       0 0.4225000        PSDB        45 SEBASTI\xeaO
BOCALOM RODRIGUES      2394
ACACRELANDIA-2004     402 0.3943083        PSDB        45 SEBASTI\xeaO
BOCALOM RODRIGUES      2394
ACACRELANDIA-2005     742 0.5401000        PSDB        45 SEBASTI\xcdO
BOCALOM RODRIGUES      2173
ACACRELANDIA-2006     779 0.5138000        PSDB        45 SEBASTI\xcdO
BOCALOM RODRIGUES      2173
ACACRELANDIA-2007     932 0.5109000        PSDB        45 SEBASTI\xcdO
BOCALOM RODRIGUES      2173
ACACRELANDIA-2008     968 0.5593250        PSDB        45 SEBASTI\xcdO
BOCALOM RODRIGUES      2173
                  mayor.vot.per
 mayor.coalt voters.able
ACACRELANDIA-2003        0.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS /
PDT        6422
ACACRELANDIA-2004        0.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS /
PDT        6422
ACACRELANDIA-2005        0.4082               PP / PDT / PMDB / PPS / PFL /
PSDB        6422
ACACRELANDIA-2006        0.4082               PP / PDT / PMDB / PPS / PFL /
PSDB        6422
ACACRELANDIA-2007        0.4082               PP / PDT / PMDB / PPS / PFL /
PSDB        7548
ACACRELANDIA-2008        0.4082               PP / PDT / PMDB / PPS / PFL /
PSDB        7548
                  presd.turnout lula.vot lula.vot.per transfers.cap pt.dummy
pres.turnout.cap
ACACRELANDIA-2003          4282     2202      0.51425     0.1058079        0
       0.4924669
ACACRELANDIA-2004          4282     2202      0.51425     0.0000000        0
       0.4013873
ACACRELANDIA-2005          4282     2202      0.51425     4.3041656        0
       0.3739411
ACACRELANDIA-2006          4282     2202      0.51425    32.6658748        0
       0.3633124
ACACRELANDIA-2007          5461     2422      0.44400   138.8654514        0
       0.4740451
ACACRELANDIA-2008          5461     2422      0.44400   108.0337032        0
       0.4555769
                    pib.cap mun.vote mun.vote2 mun.vote3 mayor.party.r
mayor.party.r2 lula.vot.weight
ACACRELANDIA-2003  7.878865        1        PT      0.PT             0
2.Opposition    5.084315e-06
ACACRELANDIA-2004  9.117160        1        PT      0.PT             0
2.Opposition    5.084315e-06
ACACRELANDIA-2005  9.998542        1        PT      0.PT             0
2.Opposition    5.084315e-06
ACACRELANDIA-2006 10.300560        1        PT      0.PT             0
2.Opposition    5.084315e-06
ACACRELANDIA-2007 12.683194        0      PSDB    1.PSDB             0
2.Opposition    5.592285e-06
ACACRELANDIA-2008 12.185059        0      PSDB    1.PSDB             0
2.Opposition    5.592285e-06
                  trans.dummy transfers.cap.lag     year2 district term
pt.pt pt.coa pt.opp psdb.pt
ACACRELANDIA-2003           1                NA 2003-2004   PT/Opo    0
0      0      1       0
ACACRELANDIA-2004           0                NA 2003-2004   PT/Opo    0
0      0      1       0
ACACRELANDIA-2005           1         474.56074 2005-2006   PT/Opo    0
0      0      1       0
ACACRELANDIA-2006           1          22.94781 2005-2006   PT/Opo    0
0      0      1       0
ACACRELANDIA-2007           1           0.00000 2007-2008 PSDB/Opo    1
0      0      0       0
ACACRELANDIA-2008           1           0.00000 2007-2008 PSDB/Opo    1
0      0      0       0
                  psdb.coa psdb.opp time transf.log
ACACRELANDIA-2003        0        0    1  -2.236723
ACACRELANDIA-2004        0        0    2  -6.907755
ACACRELANDIA-2005        0        0    3   1.459816
ACACRELANDIA-2006        0        0    4   3.486362
ACACRELANDIA-2007        0        1    1   4.933513
ACACRELANDIA-2008        0        1    2   4.682453

tob6 <- censReg(transfers.cap ~ pt.pt + psdb.pt + pt.opp + pt.coa + psdb.coa
+ transfers.cap.lag + pib.cap + ifdm + log(populat) + mayor.vot.per +
bol.fam + factor(uf.name) + factor(year), left=0, right=Inf, method="BHHH",
nGHQ=15, data = pdata)

Error in maxNRCompute(fn = logLikAttr, fnOrig = fn, gradOrig = grad,
hessOrig = hess,  :
  NA in the initial gradient

Thanks!

*Felipe Nunes*
CAPES/Fulbright Fellow
PhD Student Political Science - UCLA
Web: felipenunes.bol.ucla.edu



On Sat, Sep 17, 2011 at 10:44 PM, Arne Henningsen <
arne.henning...@googlemail.com> wrote:

> On 18 September 2011 04:58, Felipe Nunes <felipnu...@gmail.com> wrote:
> > Do you guys know how could I increase the time limit for the iterations
> in
> > censReg? I'm receiving the following message whatever method I use:
> > Newton-Raphson maximisation, 150 iterations
> > Return code 4: Iteration limit exceeded.
> > Log-likelihood: -67680.41 on 42 Df
>
> You can use argument "iterlim" to increase the maximum number of
> iterations, see documentation of maxNR().
>
> /Arne
>
> --
> Arne Henningsen
> http://www.arne-henningsen.name
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to