Graphics using RCommander

FD

2022-02-16

## Loading required package: splines
## Loading required package: RcmdrMisc
## Loading required package: car
## Loading required package: carData
## Loading required package: sandwich
## Warning in register(): Can't find generic `scale_type` in package ggplot2 to
## register S3 method.
## Loading required package: effects
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
## The Commander GUI is launched only in interactive sessions
## 
## Attaching package: 'Rcmdr'
## The following object is masked from 'package:base':
## 
##     errorCondition
> HousePrices <- 
+   read.table("C:/Users/filip/OneDrive/Desktop/MSCI 3230/HousePrices.csv", 
+   header=TRUE, stringsAsFactors=TRUE, sep=",", na.strings="NA", dec=".", 
+   strip.white=TRUE)
> normalityTest(~Price, test="shapiro.test", data=HousePrices)

    Shapiro-Wilk normality test

data:  Price
W = 0.98023, p-value = 0.05836
> summary(HousePrices)
     Price             SqFt         Bedrooms       Bathrooms    
 Min.   : 69100   Min.   :1450   Min.   :2.000   Min.   :2.000  
 1st Qu.:111325   1st Qu.:1880   1st Qu.:3.000   1st Qu.:2.000  
 Median :125950   Median :2000   Median :3.000   Median :2.000  
 Mean   :130427   Mean   :2001   Mean   :3.023   Mean   :2.445  
 3rd Qu.:148250   3rd Qu.:2140   3rd Qu.:3.000   3rd Qu.:3.000  
 Max.   :211200   Max.   :2590   Max.   :5.000   Max.   :4.000  
     Offers      Brick    Neighborhood
 Min.   :1.000   No :86   East :45    
 1st Qu.:2.000   Yes:42   North:44    
 Median :3.000            West :39    
 Mean   :2.578                        
 3rd Qu.:3.000                        
 Max.   :6.000                        
> library(abind, pos=17)
> library(e1071, pos=18)
> local({
+   .Table <- with(HousePrices, table(Brick))
+   cat("\ncounts:\n")
+   print(.Table)
+   cat("\npercentages:\n")
+   print(round(100*.Table/sum(.Table), 2))
+ })

counts:
Brick
 No Yes 
 86  42 

percentages:
Brick
   No   Yes 
67.19 32.81 
> local({
+   .Table <- with(HousePrices, table(Neighborhood))
+   cat("\ncounts:\n")
+   print(.Table)
+   cat("\npercentages:\n")
+   print(round(100*.Table/sum(.Table), 2))
+ })

counts:
Neighborhood
 East North  West 
   45    44    39 

percentages:
Neighborhood
 East North  West 
35.16 34.38 30.47 
> cor(HousePrices[,c("Bathrooms","Bedrooms","Offers","Price","SqFt")], 
+   use="complete")
          Bathrooms  Bedrooms     Offers      Price      SqFt
Bathrooms 1.0000000 0.4145560  0.1437934  0.5232578 0.5227453
Bedrooms  0.4145560 1.0000000  0.1142706  0.5259261 0.4838071
Offers    0.1437934 0.1142706  1.0000000 -0.3136359 0.3369234
Price     0.5232578 0.5259261 -0.3136359  1.0000000 0.5529822
SqFt      0.5227453 0.4838071  0.3369234  0.5529822 1.0000000
> cor(HousePrices[,c("Bathrooms","Bedrooms","Offers","Price","SqFt")], 
+   use="pairwise.complete")
          Bathrooms  Bedrooms     Offers      Price      SqFt
Bathrooms 1.0000000 0.4145560  0.1437934  0.5232578 0.5227453
Bedrooms  0.4145560 1.0000000  0.1142706  0.5259261 0.4838071
Offers    0.1437934 0.1142706  1.0000000 -0.3136359 0.3369234
Price     0.5232578 0.5259261 -0.3136359  1.0000000 0.5529822
SqFt      0.5227453 0.4838071  0.3369234  0.5529822 1.0000000
> with(HousePrices, Hist(Price, scale="frequency", breaks="Sturges", 
+   col="darkgray"))