Tag Archives:

How to solve the problem of “no observations” in Stata?

When regression, time series analysis and panel data analysis are carried out in Stata, the problem of “no observations” often appears, as follows:

This is the excel format data of the relevant time series of US Treasury bond interest rates from January 2009 to December 2017

When we import the excel file through the file import Excel spreadsheet menu in Stata and name the first line as a variable, we import the excel file into Stata

At this point, when we test the unit root of tb1yr (first, we need tsset date to define the time variable), we will encounter the problem of “no observations”

By querying the relevant websites and their information, we can find that the problem of “no observations” is not entirely due to the missing value of tb1yr or the character type value of the variable. The main reason is that although the date variable is an int or float variable, its data format is 1/1/2009, It does not conform to the traditional Stata data format about time and date

In order to solve this problem, many people on the Internet have put forward the method of dividing date, replacing, and converting date into “numerical variable”

DATE already numeric; No replace indicates that date is numeric and no conversion is needed

Many people on the Internet have adopted many methods, but they are not effective. What should we do to solve this problem

The author thinks that since the problem lies in date and the attribute of date can’t be changed by various means, it’s better to regenerate a variable t about date and endow it with numerical value to solve the problem

Because the date variable date or t does not participate in the actual regression or time series analysis process, but is a defined index variable. The solution process is as follows:

A completely numerical time variable is generated by Egen t = group (date), and then it is defined by tsset T. finally, the unit root test is carried out. It can be seen that the problem of “no observations” will not appear

In this case, the representation of T variable is as follows:

this article shares WeChat’s official account – Dr. PhD’s dry cargo (econometrics_ ABC)。

What is [unity] assembly definition?

What is assembly definition

We know that unity automatically defines how scripts are compiled into managed assemblies. After all scripts are compiled, a managed assembly is generated. Naturally, as we add more and more scripts, the compilation time will be longer and longer. If the project becomes large enough, the waiting compilation time is quite terrible

In this way, the assembly definition file (assembly definition file) arises at the historic moment, which can be used to reduce the compilation time

principle basis:

The script is saved in different folders. An assembly definition file is generated from a folder containing multiple scripts. When one of the scripts is modified, only the assembly definition file containing the script will be recompiled, and the others will not be recompiled, so as to reduce the compilation time

As shown in the figure:

How to use assembly definition

Use the following menu to create an assembly definition file:

The created file is also regarded as a resource file. The suffix of the file ends with. Asmdef

How to set assembly definition

Create an assembly definition file in a folder. All scripts in the folder will be compiled into the assembly definition file. After selecting the assembly definition file

The inspector property panel is shown as follows:

First name: set the assembly name( The name of the folder where the assembly definition file is located, the name of the assembly definition file itself, and the assembly name set in the property panel do not affect each other.)

Second references: click the plus sign to add other assembly definition files referenced by the assembly definition file( Use references to compile assemblies in unity and define their direct dependencies)

Third, unity References: check this option if the assembly is used for testing( The assembly will not be added to the predefined assembly file, such as assembly-csharp.dll, nor will it be added to the packaging file.)

Fourth option: check this option if the unsafe keyword is used in the script in the assembly file

Fifth, platforms: set the platform compatibility of the assembly definition file( Some special platforms can be excluded or included)

assembly definition hierarchy

In the multi-level folder structure, the Script Compilation belongs to the corresponding assembly definition file according to the shortest path

For example:

There are three paths:

Asset/Scripts/Main.asmdef

Asset/Scripts/Example1/Example1.asmdef

Asset/Scripts/Example1/Example2/Example2.asmdef

In this way, all scripts in the folder example2 will be compiled into the assembly definition file example2

All scripts in the folder example1 are compiled into the assembly definition file example1

All other scripts in the scripts folder but not in example1 and example2 will be compiled into the assembly definition file main

assembly definition file is not an assembly generation file

The assembly definition file is not an assembly generation file. It does not support the rules of conditional generation in the generation system. This is also the reason why the assembly definition file does not support setting preprocessing instructions, because these preprocessing instructions are always static

backward compatible implicit dependency

The assembly definition file is backward compatible with the definition compilation system in unity. This means that predefined assemblies always depend on the assembly of each assembly definition file. This is similar to how all scripts in unity depend on all the precompiled assemblies (plugins /. DLLs) that are compatible with the target

The following figure illustrates the dependencies between predefined assemblies and assembly definition files assemblies and precompiled assemblies:

The priority of the assembly definition file set in unity is higher than that of the predefined compilation system. This means that if there are some pre-defined special folders in the assembly definition file (such as resources, editor, plugins, etc.) in the compilation system, they will only exist as ordinary folders and will not have any special meaning

strongly recommend:

Either use the assembly definition file for all scripts in the project, or none at all. Otherwise, scripts that do not use the assembly definition file will still be recompiled after modification, which is a waste of time. This makes the script that uses the assembly definition file meaningless

If we open the assembly definition file, we will find that it is actually a JSON file

It contains name, references, include platforms and exclude platforms fields

All of them are optional except name

Well, that’s all for the assembly definition file. After we understand it, we must try to use it in the project, so that we can better grasp and play its role

To be continued

Come on~

welcome scan code to pay attention to official account, get continuous update

Dear guests, if you think it’s useful, please like it and share it~

this article is shared by WeChat official account – game developer development and sharing (No_ 2SeeYou)。