RATS 11
RATS 11

Procedures /

PRINCOMP Procedure

Home Page

← Previous Next →

@PRINCOMP is a simple procedure for extracting principal components from a set of series. The related procedure @PRINFACTORS can be used for doing more complicated principal components-based factor analysis.

 

@PRINCOMP( options )   start  end  pcomp

# list of variables (in Regression Format, if no EQUATION option)

Parameters

start, end

range to use. By default, the common range of the list of variables.

pcomp

(output) VECTOR[SERIES] to hold the extracted principal components.

Options

NCOMPS=number of components to extract [number of variables]

 

EQUATION=equation providing list of variables

This is an alternative to using the supplementary card.

 

CENTER/[NOCENTER]

CORR/[NOCORR]

With CENTER, means are subtracted from all variables. With CORR, all variables get converted to mean zero, unit variance. The principal components are different depending upon which if any of these you choose.

 

PRINT/[NOPRINT]

Example

*

* Greene, Econometric Analysis, 7th Edition

* Example 6.3 from page 152

*

open data tablef4-3.txt

data(format=prn,org=columns) 1 62 box mprating budget starpowr sequel $

 action comedy animated horror addict cmngsoon fandango cntwait3

set logbox  = log(box)

set is_g    = mprating==1

set is_pg   = mprating==2

set is_pg13 = mprating==3

set is_r    = mprating==4

set logbudget = log(budget)

linreg logbox

# constant action comedy animated horror is_g is_pg is_pg13 $

  logbudget sequel starpowr

*

set buzz1 = log(addict)

set buzz2 = log(cmngsoon)

set buzz3 = log(fandango)

*

@princomp(corrs,ncomps=1) / pcbuzz

# buzz1 buzz2 buzz3 cntwait3

*

* The value of the coefficient on the "buzz" variable is different

* because of scale. Note that t-stat and all other coefficients are

* identical to the ones in the book.

*

linreg logbox

# constant action comedy animated horror is_g is_pg is_pg13 $

  logbudget sequel starpowr pcbuzz(1)


 


Copyright © 2025 Thomas A. Doan