Sie sind auf Seite 1von 3

Q1

library(readr)
> X20090701 <- read_delim("20090701", "|",
+ escape_double = FALSE, col_names = FALSE,
+ trim_ws = TRUE)
Parsed with column specification:
cols(
X1 = col_character(),
X2 = col_time(format = ""),
X3 = col_double()
)
library(readr)
> X20090702 <- read_delim("20090702", "|",
+ escape_double = FALSE, col_names = FALSE,
+ trim_ws = TRUE)
Parsed with column specification:
cols(
X1 = col_character(),
X2 = col_time(format = ""),
X3 = col_double()
)
library(readr)
> X20090703 <- read_delim("20090703", "|",
+ escape_double = FALSE, col_names = FALSE,
+ trim_ws = TRUE)
Parsed with column specification:
cols(
X1 = col_character(),
X2 = col_time(format = ""),
X3 = col_double()
)

NiftyData=na.omit(merge(X20090701,X20090702,X20090703),join="inner")
Q2.

# set directory

#install package data.table

library(data.table) # calling data.table

SJA_Trades <- read.table("20090826.trd", header = FALSE, sep="|")

Value=NULL

SJA_Trades$Value= SJA_Trades$V5*SJA_Trades$V6

#Value=NULL

#SJA_Trades["Value"] <- NA

#for (i in unique(my_data$trd_id)){

# my_data$Value = my_data$price[i]*my_data$qty_trd[i]

#}

by(SJA_Trades, SJA_Trades$V2, function(x){

# caculate the sum of Value

Sum_Value <- sum(x$Value)

})

by(SJA_Trades, SJA_Trades$V2, function(y){

# caculate the sum of quantity

sum_Trd_Qty <- sum(y$V6)

})

by(SJA_Trades, SJA_Trades$V2, function(z){

# caculate the weighted average

wt_avg <- sum(z$Value)/sum(z$V6)

})
Q3
a) lm(formula = Housing ~ Density + Income + LocTax + PopChang +
StateTax + UnempRt + Value, data = Q3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 813.36818 2410.54076 0.337 0.738
Density 0.07529 0.09487 0.794 0.433
Income 110.41109 72.75856 1.517 0.139
LocTax -0.06112 0.90998 -0.067 0.947
PopChang 26.76589 16.12570 1.660 0.107
StateTax -1.00593 1.17913 -0.853 0.400
UnempRt -76.54639 107.89023 -0.709 0.483
Value -0.85504 0.54966 -1.556 0.130

b) Density = Positive (Greater density, more housing demand)


Income = Positive (Greater income, more housing demand)
LocTax = Negative (Greater taxes, low housing demand)
PopChang = Positive (Greater Pop growth, more housing demand)
StateTax = Negative (Greater taxes, low housing demand)
UnempRt = Negative (Greater Unemployment, low housing demand)
Value = Negative (Greater prices, low housing demand)

c) T-value for all the variables in below 2; model needs to restructured

Das könnte Ihnen auch gefallen