Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Eviews5 / EViews5 / Docs / EViews 5 Command Ref.pdf
Скачиваний:
91
Добавлен:
23.03.2015
Размер:
5.23 Mб
Скачать

linefit—337

linefit

Group View

 

 

Scatter plot with bivariate fit.

Displays the scatter plot of the second series (horizontal axis) and the first series (vertical axis) with a regression fit line. You can specify various transformation methods and weighting for the bivariate fit.

Syntax

 

Group View:

group_name.linefit(options)

Options

 

 

 

 

 

yl

Take the natural log of first series, y .

 

 

 

 

yi

Take the inverse of y .

 

 

 

 

yp=number

Take y to the power of the specified number.

 

 

 

 

yb=number

Take the Box-Cox transformation of y with the speci-

 

 

fied parameter.

 

 

 

 

xl

Take the natural log of x .

 

 

 

 

xi

Take the inverse of x .

 

 

 

 

xp=number

Take x to the power of the specified number.

 

 

 

 

xb=number

Take the Box-Cox transformation of x with the speci-

 

 

fied parameter.

 

 

 

 

xd=integer

Fit a polynomial of x up to the specified power.

 

 

 

 

m=integer

Set number of robustness iterations.

 

 

 

 

s=name

Save the fitted y series.

 

 

 

 

p

Print the scatter plot.

If the polynomial degree of x leads to singularities in the regression, EViews will automatically drop the high order terms to avoid collinearity.

Examples

group g1 inf unemp

g1.linefit(yl,xl,s=yfit)

338—Appendix B. Command Reference

displays a scatter plot of log UNEMP against log INF together with the fitted values from a regression of log UNEMP on the log INF. The fitted values are saved in a series named YFIT. Note that the saved fitted values are for the original UNEMP, not the log transform.

g1.linefit(yb=0.5,m=10)

The Box-Cox transformation of UNEMP with parameter 0.5 is regressed on INF with 10 iterations of bisquare weights.

Cross-references

See “Scatter with Regression” on page 399 of the User’s Guide for a discussion of scatter plot with regression fit.

See also nnfit (p. 372) and kerfit (p. 329).

link

Object Declaration

 

 

Create a series link object.

Declares a link object which may be used to refer to data in a series contained in a different workfile page. Links are used to create automatically updating match merges using identifier series or using dates (frequency conversion).

Syntax

Command:

link link_name

Command: link link_name.linkto(options) link specification

Follow the link keyword with the name to be given to the link object. If desired, you may combine the declaration with the linkto (p. 339) proc in order to provide a full link specification.

Examples

link mylink

creates the link MYLINK with no link specification, while,

link l1.linkto(c=obs,nacat) indiv\x @src ind1 ind2 @dest ind1 ind2

combines the link declaration with the link specification step.

Cross-references

For a discussion of linking, see Chapter 8, “Series Links”, on page 175 of the User’s Guide.

linkto—339

See also linkto (p. 339) and unlink (p. 519).

linkto

Link Proc

 

 

Define the specification of a series link.

Specify the method by which the object uses data in an existing series. Links are used to perform cross-page match merging or frequency conversion.

Syntax

Link Proc:

link_name.linkto(options) source_page\series_name [src_id

 

dest_id]

Link Proc:

link_name.linkto(options) source_page\series_name [@src src_ids

 

@dest dest_ids]

The most common use of linkto will be to define a link that employs general match merging. You should use the keyword linkto followed by any desired options, and then provide the name of the source series followed by the names of the source and destination IDs. If more than one identifier series is used, you must separate the source and destination IDs using the “@SRC” and “@DEST” keywords.

In the special case where you wish to link your data using date matching, you must use the special keyword “@DATE” as an ID series for a regular frequency page. If “@DATE” is not specified as either a source or destination ID, EViews will perform an exact match merge using the specified identifiers.

The other use of linkto will be to define a frequency conversion link between two date structured pages. To specify a frequency conversion link, you should use the linkto keyword followed by any desired options and then the name of a numeric source series. You must not specify ID series since a frequency conversion link uses the implicit dates associated with the regular frequency pages—if ID series are specified, the link will instead employ general match merging. Note also that if ID series are not specified, but a general match merge specific conversion option is provided (e.g., “c=med”), “@DATE @DATE” will be appended to the list of IDs and a general match merge employed.

It is worth mentioning that a frequency conversion link that uses an alpha source series will generate an evaluation error.

Note that linking by frequency conversion is the same as linking by general match merge using the source and destination IDs “@DATE @DATE” with the following exceptions:

General match merge linking offers contraction methods not available with frequency conversion (e.g., median, variance, skewness).

340—Appendix B. Command Reference

General match merge linking allows you to use samples to restrict the source observations used in evaluating the link.

General match merge linking allows you to treat NA values in the ID series as a category to be used in matching.

Frequency conversion linking offers expansion methods other than repeat.

Frequency conversion linking provides options for the handling of NA values.

Frequency conversion linking uses special handling for panel structured pages. Links involving panel pages first perform a mean contraction in the source page, if necessary, then a frequency conversion to the destination page, then an expansion in the destination, if necessary.

Options

General Match Merge Link Options

The following options are available when linking with general match merging:

smpl=

Sample to be used when computing contractions in a

smpl_spec

link by match merge. Either provide the sample range

 

in double quotes or specify a named sample object. By

 

default, EViews will use the entire workfile sample

 

“@ALL”.

 

 

linkto—341

c=arg

Set the match merge contraction or the frequency con-

 

version method.

 

If you are linking a numeric source series by general

 

match merge, the argument can be one of: “mean”,

 

“med” (median), “max”, “min”, “sum”, “sumsq” (sum-

 

of-squares), “var” (variance), “sd” (standard devia-

 

tion), “skew” (skewness), “kurt” (kurtosis), “quant”

 

(quantile, used with “quant=” option), “obs” (number

 

of observations), “nas” (number of NA values), “first”

 

(first observation in group), “last” (last observation in

 

group), “unique” (single unique group value, if

 

present), “none” (disallow contractions).

 

If linking an alpha series, only the non-summary meth-

 

ods “max”, “min”, “obs”, “nas”, first”, “last”, “unique”

 

and “none” are supported. For numeric links, the

 

default contraction method is “c=mean”; for alpha

 

links, the default is “c=unique”.

 

If you are linking by frequency conversion, you may use

 

this argument to specify the upor down-conversion

 

method using the options found in fetch (p. 291). The

 

default frequency conversion methods are taken from

 

the series defaults.

quant=number Quantile value to be used when contracting using the “c=quant” option (e.g, “quant=.3”).

nacat

Treat “NA” values as a category when performing link

 

by general match merge operations.

Most of the conversion options should be self-explanatory. As for the others: “first” and “last” give the first and last non-missing observed for a given group ID; “obs” provides the number of non-missing values for a given group; “nas” reports the number of NAs in the group; “unique” will provide the value in the source series if it is the identical for all observations in the group, and will return NA otherwise; “none” will cause the link to fail if there are multiple observations in any group—this setting may be used if you wish to prohibit all contractions.

On a match merge expansion, linking by ID will repeat the values of the source for every matching value of the destination. If both the source and destination have multiple values for a given ID, EViews will first perform a contraction in the source (if not ruled out by “c=none”), and then perform the expansion by replicating the contracted value in the destination.

342—Appendix B. Command Reference

Frequency Conversion Link Options

If the linkto command does not specify identifier series, EViews will link series data using frequency conversion where appropriate.

The following options control the frequency conversion method when creating a frequency conversion link, converting from low to high frequency:

c=arg

Low to high conversion methods: “r” (constant match

 

average), “d” (constant match sum), “q” (quadratic

 

match average), “t” (quadratic match sum), “i” (linear

 

match last), “c” (cubic match last).

 

 

The following options control the frequency conversion method when creating a frequency conversion link, converting from high to low frequency:

c=arg

High to low conversion methods removing NAs: “a”

 

(average of the nonmissing observations), “s” (sum of

 

the nonmissing observations), “f” (first nonmissing

 

observation), “l” (last nonmissing observation), “x”

 

(maximum nonmissing observation), “m” (minimum

 

nonmissing observation).

 

High to low conversion methods propagating NAs: “an”

 

or “na” (average, propagating missings), “sn” or “ns”

 

(sum, propagating missings), “fn” or “nf” (first, propa-

 

gating missings), “ln” or “nl” (last, propagating miss-

 

ings), “xn” or “nx” (maximum, propagating missings),

 

“mn” or “nm” (minimum, propagating missings).

 

 

Note that if no conversion method is specified, the series specific default conversion method or the global settings will be employed.

Examples

General Match Merge Linking

Let us start with a concrete example. Suppose our active workfile page contains observations on the 50 states of the US, and contains a series called STATE containing the unique state identifiers. We also have a workfile page called INDIV that contains data on individuals from all over the country, their incomes (INCOME), and their state of birth (BIRTHSTATE).

Now suppose that we wish to find the median income of males in our data for each possible state of birth, and then to match merge that value into our 50 observation state page.

The following commands:

linkto—343

link male_income

male_income.linkto(c=med, smpl="if male=1") indiv\income birthstate state

create the series link MALE_INCOME. MALE_INCOME contains links to the individual INCOME data, telling EViews to subsample only observations where MALE=1, to compute median values for individuals in each BIRTHSTATE, and to match observations by comparing the values of BIRTHSTATE to STATE in the current page.

In this next example, we link to the series X in the INDIV page, matching values of the IND1 and the IND2 series in the two workfile pages. The link will compute the number of valid observations in the X series for each index group, with NA values in the ID series treated as a valid identifier value.

link l1.linkto(c=obs,nacat) indiv\x @src ind1 ind2 @dest ind1 ind2

You may wish to use the “@DATE” keyword as an explicit identifier, in order to gain access to our expanded date matching feature. In our annual workfile, the command:

link gdp.linkto(c=sd) monthly\gdp @date @date

will create link that computes the standard deviation of the values of GDP for each year and then match merges these values to the years in the current page. Note that this command is equivalent to:

link gdp.linkto(c=sd) quarterly\gdp

since the presence of the match merge option “c=sd” and the absence of indices instructs EViews to perform the link by ID matching using the defaults “@DATE” and “@DATE”.

Frequency Conversion Linking

Suppose that we are in an annual workfile page and wish to link data from a quarterly page. Then the commands:

link gdp

gdp.linkto quarterly\gdp

creates a series link GDP in the current page containing a link by date to the GDP series in the QUARTERLY workfile page. When evaluating the link, EViews will automatically frequency convert the quarterly GDP to the annual frequency of the current page, using the series default conversion options. If we wish to control the conversion method, we can specify the conversion method as an option:

Соседние файлы в папке Docs