unit.variable not found as numeric variable in foo Synth Package - data-preprocessing

I am trying to run the Synthetic Control Method in R. I tried to prepare my data according to Abadie, Diamond and Hainmueller (2011) (https://www.jstatsoft.org/article/view/v042i13).
But when running the dataprep.out function I get the error message that my unit.variables are not nurmeric variables in foo. I don't understand the problem here because my table purely consists of numeric values. The table is also classified as a data.frame. I have attached some pictures to underline my problem. If anyone could help me that would be greatly appreciated!
My code (https://i.stack.imgur.com/7BVYc.png)
My table (https://i.stack.imgur.com/TV1IC.png)
I have tried to reimport my data over and over again. But nothing seems to help.

Related

<Anylogic in 3 days> Airport model tutorial error

I have been following the tutorial book "Anylogic in 3 days", in the last chapter airport model phase 6.
Setting up flights from MS excel spreadsheet, when I try to run the model after I finished all the settings, it says The method planBoardings(Flight) in the type Main is not applicable for the arguments ().
I have checked the tutorial and my model, I don't know where I did wrong.
is there anyone who had the same problem or can you tell me where I might be wrong.
I am really new to Anylogic, I really appreciate if anyone can help!
the model logic
startBoarding function I have defined according to the tutorial
the Main - Agent Type property
Not sure about the tutorial itself, but your function planBoardings does not need an argument flight.
Delete that as below:
You may also need to adjust the code. Change the line below:
such that it says create_DepartureEvent(dateToTime(f.departureTime), f)

The character in my anylogic are wrong, they change with the two following character, what can i do?

I have a real problem with Anylogic. Whe i create a model in the section palette and also the names of objects is writed with the next character. I mean if a call an object 'abc' it will be call 'cde' and i cant read nothing. Can someone help me with this? Thank you all.

Matlab GUI, sometimes listbox disappears. I used: set(handles.listbox,'value',1) and seems it does not work

In the GUI, I have two listboxes, and the data in these two listboxes can be passed to each other. A user can pass all the data to the other one, he can also select some data and pass to the other one.
The problem is: Sometime, the listbox will disappear, but all the pushbuttons works as expected. And Matlab gives a warning: Warning: multi-selection listbox control
requires that Value be an integer within String range.Control will not be rendered until all of its parameter values are valid.
I did some research, someone advises to use this: set(handles.listbox,'value',1) . But it does not solve this problem.
And what's more, I cannot figure out under what kind of circumstance this error may happen.
Can you guys please tell me how to solve this? And in which case this error may happen?
Thanks a lot.

Using matlab code in Octave - Bayes Net Toolbox

I am trying to run Kevin Murphy's Bayes Net Toolbox in Octave and encountering some problems. It doesn't help that I'm a novice at Bayesian networks, Matlab and Octave.
This toolbox was originally written for Matlab. There is a large test file called test_BNT.m which runs through all the functionality in the toolbox. Most of the error messages relate to the difference between & and && in Matlab and Octave. This is easy to fix. However, I've now come across a new problem and I don't know what to do about it.
For instance, the qmr1.m script creates an instance of the pearl_inf_engine class, sets some of the member member variables and passes the instance of the class to another function. Later on, the member variables are accessed again in a different script (parallel_protocol.m). But when this happens, the following message appears:
error: invalid index for class
error: evaluating argument list element number 1
It seems that from one script to another, it has forgotten that the class has any member variables and gives the invalid index message when you try to access them.
Is this a common error with an easy solution? Is something wrong with the path or working directory? Maybe someone else has already converted the BNT to octave and knows what to do?
Edit
I was able to get past this error message. The trick was to read the installation instructions (haha) and run addpath(genpathKPM(<BNT base directory)). genpathKPM.m is a script includes in BNT which adds all the required directories to the path.
After doing this, run test_BNT.m and change & to && and | to || at each line where it gives a warning. This will clear up most of the errors.
However, I'm still unable to run mpe1.m, mp2.m, mildew1.m and some others. The new error message I'm stuck on is:
error: invalid empty index list
error: called from:
error: C:\FullBNT-1.0.7\bnt\BNT\inference\static\#var_elim_inf_engine\find_mpe
.m at line 63, column 5
on this line of code:
eval(['sCPT.T(', sargs, num2str(jj), ')=0;']);
If I can get all the scripts to work, I'll post an answer here with the steps I took to do it.
Edit 2
I was able to get past the problem in the previous edit. Replace
eval(['sCPT.T(', sargs, num2str(jj), ')=0;']);
with
eval(['sCPT.T(', sargs, sprintf('%d',jj), ')=0;']);
The next problem is identical. Just replace num2str in the same way.
This file was apparently contributed by a user of BNT, and not written by the original author. Using eval kind of a hack, I think. A better fix would be to just rewrite the code so it doesn't use eval at all.
There is one more error in draw_graph.m, which was apparently also an outside contribution to the project. I just commented out the call to that function since I'm not interested in drawing graphs right now. After doing this, and continuing to fix shortcircuit operators, all of the tests in test_BNT.m will run.
Still, I won't create an answer for this until I can get draw_graph.m to run, too.
As a significant amount of time has passed, and the answer to the core problem was provided in the question, I will post it here so it will not stay listed as unanswered:
tl;dr: Change a few operators, solve the remaining bugs specified below, and everything works except the drawing of graphs.
Edit
I was able to get past this error message. The trick was to read the
installation instructions (haha) and run addpath(genpathKPM(<BNT base
directory)). genpathKPM.m is a script includes in BNT which adds
all the required directories to the path.
After doing this, run test_BNT.m and change & to && and | to
|| at each line where it gives a warning. This will clear up most of
the errors.
However, I'm still unable to run mpe1.m, mp2.m, mildew1.m and
some others. The new error message I'm stuck on is:
error: invalid empty index list
error: called from:
error: C:\FullBNT-1.0.7\bnt\BNT\inference\static\#var_elim_inf_engine\find_mpe
.m at line 63, column 5
on this line of code:
eval(['sCPT.T(', sargs, num2str(jj), ')=0;']);
If I can get all the scripts to work, I'll post an answer here with
the steps I took to do it.
Edit 2
I was able to get past the problem in the previous edit. Replace
eval(['sCPT.T(', sargs, num2str(jj), ')=0;']); with
eval(['sCPT.T(', sargs, sprintf('%d',jj), ')=0;']);
The next problem is identical. Just replace num2str in the same way.
This file was apparently contributed by a user of BNT, and not written
by the original author. Using eval kind of a hack, I think. A better
fix would be to just rewrite the code so it doesn't use eval at all.
There is one more error in draw_graph.m, which was apparently also
an outside contribution to the project. I just commented out the call
to that function since I'm not interested in drawing graphs right now.
After doing this, and continuing to fix shortcircuit operators, all of
the tests in test_BNT.m will run.

MATLAB error: Error Saving Figure: "Object must have an ancestor of type 'figure'"

In MATLAB 2012a,
I'm trying to save a figure as a .fig file, and all I get is a window with
Title: Error Saving Figure
Message: Object must have an ancestor of type 'figure'.
I googled this error message, and Google was able to predict my search perfectly, meaning other people have searched the same error message before .. however there is not a single page online that actually discusses this error.
I know that I haven't given much information, and I apologize for this, but I can't imagine what other details to give. 2 minutes ago I saved a different figure generated by the exact same program, in the exact same way, as a .fig file with no problems.
What does this error message mean and how do I fix the problem so that I can save figures in .fig format again ?
Edit: I am trying to save the file from the GUI.
Your problem seems to relate to how the GUI builds the figures:
* the parent object is of type 'figure'
* this object has some children of (usually) type 'axis'
* most graphical objects (lines, text, etc) belong to an axis.
It appears to go wrong with figures that have not been built the 'figure;plot(),etc...' way, eg with objects added later to the figure (eg 'legend') or plots that have been made with custom commands ('hist', 'bar3', etc).
My guess is that some GUI object has been added that does not have the figure handle as its 'ancestor'.
Queries about this problem outside StackOverflow seem to involve matlab function
"getproxyvaluefromhandle". Maybe googling that helps. Someone found help decomposing a figure here (seems to be a mix of Matlab, English and German)
If you have no code can you at least please describe what's in the figure? Otherwise the answers will be as hand-wavy as the question...