R Dataset / Package datasets / longley


On this R-data statistics page, you will find information about the longley data set which pertains to Longley's Economic Regression Data. The longley data set is found in the datasets R package. You can load the longley data set in R by issuing the following command at the console data("longley"). This will load the data into a variable called longley. If R says the longley data set is not found, you can try installing the package by issuing this command install.packages("datasets") and then attempt to reload the data. If you need to download R, you can go to the R project website. You can download a CSV (comma separated values) version of the longley R data set. The size of this file is about 792 bytes.

Longley's Economic Regression Data


A macroeconomic data set which provides a well-known example for a highly collinear regression.




A data frame with 7 economical variables, observed yearly from 1947 to 1962 (n=16).


GNP implicit price deflator (1954=100)


Gross National Product.


number of unemployed.


number of people in the armed forces.


‘noninstitutionalized’ population 14 years of age.


the year (time).


number of people employed.

The regression lm(Employed ~ .) is known to be highly collinear.


J. W. Longley (1967) An appraisal of least-squares programs from the point of view of the user. Journal of the American Statistical Association 62, 819–841.


Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.


require(stats); require(graphics)
## give the data set in the form it is used in S-PLUS:
longley.x <- data.matrix(longley[, 1:6])
longley.y <- longley[, "Employed"]
pairs(longley, main = "longley data")
summary(fm1 <- lm(Employed ~ ., data = longley))
opar <- par(mfrow = c(2, 2), oma = c(0, 0, 1.1, 0),
            mar = c(4.1, 4.1, 2.1, 1.1))

Dataset imported from https://www.r-project.org.

Title Authored on Content type
OpenIntro Statistics Dataset - dream August 9, 2020 - 12:25 PM Dataset
OpenIntro Statistics Dataset - winery_cars August 9, 2020 - 2:38 PM Dataset
R Dataset / Package HSAUR / toothpaste March 9, 2018 - 1:06 PM Dataset
R Dataset / Package HSAUR / pottery March 9, 2018 - 1:06 PM Dataset
R Dataset / Package HistData / Guerry March 9, 2018 - 1:06 PM Dataset
<iframe src="https://r-data.pmagunia.com/iframe/r-dataset-package-datasets-longley.html" frameBorder="0" width="100%" height="307px" />
Attachment Size
dataset-70074.csv 792 bytes
Dataset License
GNU General Public License v2.0
Documentation License
GNU General Public License v2.0

This documentation is licensed under GPLv3 or later.