R Dataset / Package MASS / housing
Attachment | Size |
---|---|
dataset-16913.csv | 14.6 KB |
Documentation |
---|
On this Picostat.com statistics page, you will find information about the housing data set which pertains to Frequency Table from a Copenhagen Housing Conditions Survey. The housing data set is found in the MASS R package. Try to load the housing data set in R by issuing the following command at the console data("housing"). This may load the data into a variable called housing. If R says the housing data set is not found, you can try installing the package by issuing this command install.packages("MASS") and then attempt to reload the data with library("MASS") followed by data("housing"). Perhaps strangley, if R gives you no output after entering a command, it means the command succeeded. If it succeeded you can see the data by typing housing at the command-line which should display the entire dataset. 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 housing R data set. The size of this file is about 14,953 bytes. Frequency Table from a Copenhagen Housing Conditions SurveyDescriptionThe Usagehousing Format
SourceMadsen, M. (1976) Statistical analysis of multiple contingency tables. Two examples. Scand. J. Statist. 3, 97–106. Cox, D. R. and Snell, E. J. (1984) Applied Statistics, Principles and Examples. Chapman & Hall. ReferencesVenables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer. Examplesoptions(contrasts = c("contr.treatment", "contr.poly"))# Surrogate Poisson models house.glm0 <- glm(Freq ~ Infl*Type*Cont + Sat, family = poisson, data = housing) summary(house.glm0, cor = FALSE)addterm(house.glm0, ~. + Sat:(Infl+Type+Cont), test = "Chisq")house.glm1 <- update(house.glm0, . ~ . + Sat*(Infl+Type+Cont)) summary(house.glm1, cor = FALSE)1 - pchisq(deviance(house.glm1), house.glm1$df.residual)dropterm(house.glm1, test = "Chisq")addterm(house.glm1, ~. + Sat:(Infl+Type+Cont)^2, test = "Chisq")hnames <- lapply(housing[, -5], levels) # omit Freq newData <- expand.grid(hnames) newData$Sat <- ordered(newData$Sat) house.pm <- predict(house.glm1, newData, type = "response") # poisson means house.pm <- matrix(house.pm, ncol = 3, byrow = TRUE, dimnames = list(NULL, hnames[[1]])) house.pr <- house.pm/drop(house.pm %*% rep(1, 3)) cbind(expand.grid(hnames[-1]), round(house.pr, 2))# Iterative proportional scaling loglm(Freq ~ Infl*Type*Cont + Sat*(Infl+Type+Cont), data = housing) # multinomial model library(nnet) (house.mult<- multinom(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)) house.mult2 <- multinom(Sat ~ Infl*Type*Cont, weights = Freq, data = housing) anova(house.mult, house.mult2)house.pm <- predict(house.mult, expand.grid(hnames[-1]), type = "probs") cbind(expand.grid(hnames[-1]), round(house.pm, 2))# proportional odds model house.cpr <- apply(house.pr, 1, cumsum) logit <- function(x) log(x/(1-x)) house.ld <- logit(house.cpr[2, ]) - logit(house.cpr[1, ]) (ratio <- sort(drop(house.ld))) mean(ratio)(house.plr <- polr(Sat ~ Infl + Type + Cont, data = housing, weights = Freq))house.pr1 <- predict(house.plr, expand.grid(hnames[-1]), type = "probs") cbind(expand.grid(hnames[-1]), round(house.pr1, 2))Fr <- matrix(housing$Freq, ncol = 3, byrow = TRUE) 2*sum(Fr*log(house.pr/house.pr1))house.plr2 <- stepAIC(house.plr, ~.^2) house.plr2$anova -- Dataset imported from https://www.r-project.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 |
---|---|---|
R Dataset / Package Stat2Data / TwinsLungs | March 9, 2018 - 1:06 PM | Dataset |
R Dataset / Package DAAG / psid1 | March 9, 2018 - 1:06 PM | Dataset |
R Dataset / Package quantreg / gasprice | March 9, 2018 - 1:06 PM | Dataset |
R Dataset / Package datasets / nottem | March 9, 2018 - 1:06 PM | Dataset |
R Dataset / Package DAAG / hills2000 | March 9, 2018 - 1:06 PM | Dataset |