Derive – Formula

Deriving a field as a Formula is extremely common, especially when working with continuous fields. Some of the most common methods of deriving a field as a formula include creating total scores, change scores and ratios. Our data file does not contain many continuous fields, however we do have several income related fields (capital gains, capital losses, and dividends) in the dataset that might be able to shed insight. Clearly, since we are predicting income, we cannot use the actual fields, capital gains, capital losses, or dividends, because all of these fields contribute to a person's overall income, and including them would create a biased model. However, rather than using actual investment dollars, we could investigate if having investments relates to income. Therefore, in order to determine if someone has investments, we first need to create a temporary field, which we will call Stock_numbers, which simply adds up capital gains, capital losses, and dividends. If someone has a value on this new field, then we will know they have investments. To create a new field:

  1. Type Stock_numbers in the Derive field textbox.

You can type the equation in the Formula textbox, but it is easier to invoke the Expression Builder, in which you can create an expression by clicking the functions, operations, and fields from list boxes.

  1. Click the Expression Builder button.
  2. Click on Capital_gains in the Fields list box, then click the insert button (the yellow arrow).
  1. Click on the plus (+) button.
  2. Double-click on Capital_losses in the Fields list box.
  3. Click on the plus (+) button.
  4. Double-click on Dividends in the Fields list box:
  1. Click OK.

We can now see the formula that will be used to create the new temporary field, Stock_numbers:

  1. Click OK.

Now that we have identified how much each person made on their investments, let's create the field we set out to create.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.173.117