Hi Alexandr,

On 10 November 2014 17:46, Alexandr M <rus...@gmail.com> wrote:
> I am working with the package bnlear, but, probably, error is caused not by
> the package itself.

Logic sampling in cpquery() relies on handling unevaluated
expressions, so it is a tad fragile in any complex setting (inside
loops and function calls, for example). On its own, the
eval(parse(...)) trick works if you do it in the global environment,
or in relatively simple scripts.

For the simple query you are trying to do, just use likelihood weighting:

prob.s = cpquery(fitted1,
                             event=eval(parse(text="(M=='s')")),
                             evidence=list(lag1.M1='s'),
                             method = "lw")

passing str2 as a list.

Cheers,
    Marco

-- 
Marco Scutari, Ph.D.
Lecturer in Statistics, Department of Statistics
University of Oxford, United Kingdom

______________________________________________
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