Closed aeclmic closed 4 years ago
Hi,
without knowing the data and the command you use is difficult to say with certainty, but some possibilities are:
non-numeric data in your observations: bnstruct accepts only data in numeric format, so if values for some variables are labeled as e.g. A
, B
, etc, you'll have to convert them to numbers in advance;
you didn't specify which symbol indicates a missing value, and use one different from ?
;
a misunderstanding on the role of the starts.from
parameter: in bnstruct it is assumed that a discrete variable with cardinality k
takes values from 1
to k
; if your values are instead, say, from 0
to k-1
, you have to set starts.from=0
to have bnstruct internally rescale the values. All the discrete variables have to start from the same lower bound.
Your second error message seems to be related to the latter case (bnstruct expects values from 1
to k
but it sees values outside that range); but you shouldn't have observed that in the first place anyway.
These are the only possible issues that I can think of. If none of them is your case, check the formatting of your input files (the reading isn't too robust at the moment). If you still have the same issue, then post here the commands you use, and, if possible, a snippet of the data and metadata.
I'm closing this issue, feel free to reopen it if you still get the error.
Hello,
For my research I have mixed (discrete and continuous), incomplete data. There is 37 variables and 707 observations.
I am trying to use the bnstruct package, but as early as loading in my data I get the above error.
The problem seems to be in the following line of code: https://github.com/cran/bnstruct/blob/698c10013bf9ec7246a302b30544d3a03aac8fb6/R/BNDataset-methods.R#L97 trying to apply the binary operator + to a matrix. Is there something wrong with my data format, or what can be the issue here?
Furthermore, when I force my way around this issue by changing + to %+%, I get the error message the following error message:
"Dataset contains values out of bounds for variables xxx", where xxx is all my variables. See below link for corresponding code.
https://github.com/cran/bnstruct/blob/698c10013bf9ec7246a302b30544d3a03aac8fb6/R/BNDataset-methods.R#L159
What can I do to fix this? Thanks in advance.