R Dataset / Package sandwich / PublicSchools
Attachment  Size 

dataset12311.csv  969 bytes 
Documentation 

On this Picostat.com statistics page, you will find information about the PublicSchools data set which pertains to US Expenditures for Public Schools. The PublicSchools data set is found in the sandwich R package. You can load the PublicSchools data set in R by issuing the following command at the console data("PublicSchools"). This will load the data into a variable called PublicSchools. If R says the PublicSchools data set is not found, you can try installing the package by issuing this command install.packages("sandwich") 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 PublicSchools R data set. The size of this file is about 969 bytes. US Expenditures for Public SchoolsDescriptionPer capita expenditure on public schools and per capita income by state in 1979. Usagedata(PublicSchools) FormatA data frame containing 51 observations of 2 variables.
SourceTable 14.1 in Greene (1993) ReferencesCribariNeto F. (2004), Asymptotic Inference Under Heteroskedasticity of Unknown Form, Computational Statistics \& Data Analysis, 45, 215233. Greene W.H. (1993), Econometric Analysis, 2nd edition. Macmillan Publishing Company, New York. US Department of Commerce (1979), Statistical Abstract of the United States. US Government Printing Office, Washington, DC. Examples## Willam H. Greene, Econometric Analysis, 2nd Ed. ## Chapter 14 ## load data set, p. 385, Table 14.1 data(PublicSchools)## omit NA in Wisconsin and scale income ps < na.omit(PublicSchools) ps$Income < ps$Income * 0.0001## fit quadratic regression, p. 385, Table 14.2 fmq < lm(Expenditure ~ Income + I(Income^2), data = ps) summary(fmq)## compare standard and HC0 standard errors ## p. 391, Table 14.3 library(sandwich) coef(fmq) sqrt(diag(vcovHC(fmq, type = "const"))) sqrt(diag(vcovHC(fmq, type = "HC0"))) if(require(lmtest)) { ## compare t ratio coeftest(fmq, vcov = vcovHC(fmq, type = "HC0"))## White test, p. 393, Example 14.5 wt < lm(residuals(fmq)^2 ~ poly(Income, 4), data = ps) wt.stat < summary(wt)$r.squared * nrow(ps) c(wt.stat, pchisq(wt.stat, df = 3, lower = FALSE))## BreschPagan test, p. 395, Example 14.7 bptest(fmq, studentize = FALSE) bptest(fmq)## Francisco CribariNeto, Asymptotic Inference, CSDA 45 ## quasi ztests, p. 229, Table 8 ## with Alaska coeftest(fmq, df = Inf)[3,4] coeftest(fmq, df = Inf, vcov = vcovHC(fmq, type = "HC0"))[3,4] coeftest(fmq, df = Inf, vcov = vcovHC(fmq, type = "HC3"))[3,4] coeftest(fmq, df = Inf, vcov = vcovHC(fmq, type = "HC4"))[3,4] ## without Alaska (observation 2) fmq1 < lm(Expenditure ~ Income + I(Income^2), data = ps[2,]) coeftest(fmq1, df = Inf)[3,4] coeftest(fmq1, df = Inf, vcov = vcovHC(fmq1, type = "HC0"))[3,4] coeftest(fmq1, df = Inf, vcov = vcovHC(fmq1, type = "HC3"))[3,4] coeftest(fmq1, df = Inf, vcov = vcovHC(fmq1, type = "HC4"))[3,4] }## visualization, p. 230, Figure 1 plot(Expenditure ~ Income, data = ps, xlab = "per capita income", ylab = "per capita spending on public schools") inc < seq(0.5, 1.2, by = 0.001) lines(inc, predict(fmq, data.frame(Income = inc)), col = 4) fml < lm(Expenditure ~ Income, data = ps) abline(fml) text(ps[2,2], ps[2,1], rownames(ps)[2], pos = 2)  Dataset imported from https://www.rproject.org. 
Picostat Manual 

How To Register With a Username
How To Register With Google Single Sign On (SSO)
How To Login With a Username and Password
How To Login With Google Single Sign On (SSO)
How To Import a Dataset
How To Perform Statistical Analysis with Picostat
How To Use Educational Applications with Picostat

Recent Queries For This Dataset 

No queries made on this dataset yet. 
Title  Authored on  Content type 

US Baby Names in 2015  March 25, 2017  6:31 PM  Dataset 
R Dataset / Package DAAG / allbacks  March 9, 2018  1:06 PM  Dataset 
R Dataset / Package DAAG / geophones  March 9, 2018  1:06 PM  Dataset 
R Dataset / Package Ecdat / Bids  March 9, 2018  1:06 PM  Dataset 
R Dataset / Package car / Womenlf  March 9, 2018  1:06 PM  Dataset 