[R] WinBUGS - R2WinBUGS problem

2009-12-16 Thread Sotiris Adamakis
l.Start   [2B8CH]
 .code PROCEDURE HostMenus.Loop


Is there anyone who can explain what does this mean and how to understand trap 
messages? For me, it seems that the problem lies here:

 .work ARRAY 10 OF REAL
   [0] REAL inf
   [1] REAL inf
   [2] REAL inf
   [3] REAL 1.30212336033939
   [4] REAL 4.534462964264759
   [5] REAL 1.769649991139459E+167
   [6] REAL 1.792592453177908E-307
   [7] REAL 9.94060079432588E-321
   [8] REAL 5.474495960374562E+67
   [9] REAL 5.257527858867595E-308

where it says that it produces some inf parameter values. I do not understand 
why this happens as the program was working fine for 5*10^5 iterations. I tried 
to change the Seed values but there was no use.

A bit of background:
1) I am running multilevel models for small area estimation and the above 
problems seem to appear only with the spatial random effects model. The 
spatial+non-spatial random effects model seems to behave properly without any 
problems.

2) As mentioned above the program was working fine for more than 50 
iterations. This means that I got no trap messages and I called the bugs 
function for more than 10 times without any problems.

It's so frustrating...

Kind regards,
Sotiris




Dr. Sotiris Adamakis
Senior Statistician - Ipsos MORI

T  +44 20 7347 3828
s<mailto:ssotiris.adama...@ipsos.com>otiris.adamakis<mailto:ssotiris.adama...@ipsos.com>@ipsos.com<mailto:ssotiris.adama...@ipsos.com>
www.ipsos-mori.com<http://www.ipsos-mori.com/>

79-81 Borough Road, London, SE1 1FY



This e-mail and all attachments it may contain is confidential and intended 
solely for the use of the individual to whom it is addressed. Any views or 
opinions presented are solely those of the author and do not necessarily 
represent those of Ipsos MORI and its associated companies. If you are not the 
intended recipient, be advised that you have received this e-mail in error and 
that any use, dissemination, printing, forwarding or copying of this e-mail is 
strictly prohibited. Please contact the sender if you have received this e-mail 
in error.

Market & Opinion Research International Ltd (trading as Ipsos MORI), Registered 
in England and Wales No. 948470, 79-81 Borough Road, London SE1 1FY, United 
Kingdom. VAT reg no. 443932151. Email: uki...@ipsos.com



[[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.


[R] "variable lengths differ (found for '(weights)')" error in Zelig library

2010-12-21 Thread Sotiris Adamakis
Dear R users,

I am trying to estimate to estimate the average treatmen effect on the
treated (ATT) using first the MatchIt software to weight the data set and,
after this, the Zelig software as shown in Ho et al. (2007). See here for an
explanation of how to apply this technique in R:

http://imai.princeton.edu/research/files/matchit.pdf

I encounter a slight problem when I apply the weights that are produced in
the stage of preprocessing the data. The idea of this is to use the MatchIt
software to preprocess the data and then use the Zelig software to generate
the distribution of ATT. I believe that the main reason for preprocessing
the data is to create weights (depending on the matching technique you use)
so that balance would be achieved for the matching variables between the
treatment and the control group. Then you use these weights in the
regressions that follow in the Zelig library. Copied from the matchit
article, whose link I provide above, the authors say:

"If one chooses options that allow matching with
replacement, or any solution that has different numbers of controls (or
treateds) within each
subclass or strata (such as full matching), then the parametric analysis
following matching
must accomodate these procedures, such as by using fixed effects or weights,
as appropriate.
(Similar procedures can also be used to estimate various other quantities of
interest such
as the average treatment effect by computing it for all observations, but
then one must
be aware that the quantity of interest may change during the matching
procedure as some
control units may be dropped.)"

The following code is for the "lalonde" data set, where I get an error
message in the end:

> library(Zelig)
> library(MatchIt)
> data(lalonde)
> m.out1 = matchit(treat ~ age + educ + black + hispan + nodegree + married
+ re74 + re75, method = "subclass", subclass=6, data = lalonde)
> z.out1 = zelig(re78 ~ age + educ + black + hispan + nodegree + married +
re74 + re75, data = match.data(m.out1, "control"), model = "ls",
weights="weights")
> x.out1 = setx(z.out1, data = match.data(m.out1, "treat"), cond = TRUE)
> s.out1 = sim(z.out1, x = x.out1)
Error in model.frame.default(formula = re78 ~ age + educ + black + hispan +
:
  variable lengths differ (found for '(weights)')

I was wondering if somebody could tell me how to get around with this
problem?

Also, I have seen people adding the propensity scores in the regression
analysis applied in the Zelig package, i.e.

> z.out1 = zelig(re78 ~ age + educ + black + hispan + nodegree + married +
re74 + re75 + *distance*, data = match.data(m.out1, "control"), model =
"ls", weights="weights")

Does anyone have a clue of why this can happen?

Kind regards,
Sotiris

[[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.