Question

Id Neighborhood NeiNumber OverallQual SalePrice 1 CollgCr 1 7 279500 2 CollgCr 1 7 208500 3...

Id Neighborhood NeiNumber OverallQual SalePrice
1 CollgCr 1 7 279500
2 CollgCr 1 7 208500
3 CollgCr 1 7 223500
4 CollgCr 1 8 230000
5 CollgCr 1 5 145000
6 BrkSide 2 5 118000
7 BrkSide 2 7 132000
8 Sawyer 3 4 90000
9 Sawyer 3 5 129500
10 Sawyer 3 5 144000
11 NridgHt 4 8 325300
12 NridgHt 4 8 256300
13 NridgHt 4 8 306000

I wish to make hierarchical bayesian model by R code but I can by find out how can I.

Homework Answers

Answer #1

new<-read.csv("1242018.csv", header = TRUE, sep = ",")

install.packages("bayesm")

Z<-new$SalePrice

Z[,1]=rep(1,nrow(Z))
Z[,2]=Z[,2]-mean(Z[,2])
Z[,3]=Z[,3]-mean(Z[,3])
Z[,4]=Z[,4]-mean(Z[,4])
Z=as.matrix(Z)
hh=levels(factor(choiceAtt$id))
nhh=length(hh)
lgtdata=NULL
for (i in 1:nhh) {
y=choiceAtt[choiceAtt[,1]==hh[i],2]
nobs=length(y)
X=as.matrix(choiceAtt[choiceAtt[,1]==hh[i],c(3:16)])
lgtdata[[i]]=list(y=y,X=X)
}
cat("Finished Reading data",fill=TRUE)
fsh()
Data=list(lgtdata=lgtdata,Z=Z)
Mcmc=list(R=20000,sbeta=0.2,keep=20)
out=rhierBinLogit(Data=Data,Mcmc=Mcmc)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Let p = (8, 10, 3, 11, 4, 0, 5, 1, 6, 2, 7, 9) and...
Let p = (8, 10, 3, 11, 4, 0, 5, 1, 6, 2, 7, 9) and let q = (2, 4, 9, 5, 10, 6, 11, 7, 0, 8, 1, 3) be tone rows. Verify that p = Tk(R(I(q))) for some k, and find this value of k.
A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14...
A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] In MATLAB. Use a fully vectorized code (ie. no loops) to determine when the numbers have increased to at least 15 in the above array. Report answer to command window.
8. (a) Determine (1 + 3)/( 5 + 7) , (1 + 3 + 5 )/(7...
8. (a) Determine (1 + 3)/( 5 + 7) , (1 + 3 + 5 )/(7 + 9 + 11) , and (1 + 3 + 5 + 7)/( 9 + 11 + 13 + 15 ). (b) Find a formula for (1 + 3 + 5 + · · · + (2n − 1))/((2n + 1) + (2n + 3)+· · + (4n − 1)) for all n ∈ Z + and then prove it.
#2. For the matrix A =   1 2 1 2 3 7 4 7...
#2. For the matrix A =   1 2 1 2 3 7 4 7 9   find the following. (a) The null space N (A) and a basis for N (A). (b) The range space R(AT ) and a basis for R(AT ) . #3. Consider the vectors −→x =   k − 6 2k 1   and −→y =   2k 3 4  . Find the number k such that the vectors...
City Code % Under 21 # of Fatals 1 16 3.822 2 7 0 3 5...
City Code % Under 21 # of Fatals 1 16 3.822 2 7 0 3 5 0.46 4 10 2.033 5 14 2.282 6 10 0.621 7 12 1.511 8 12 1.824 9 13 1.209 10 11 2.034 11 8 1.321 12 14 2.468 13 14 2.455 14 18 3.787 15 16 3.508 16 10 1.113 17 7 1.144 18 15 3.084 19 18 4.16 20 16 3.688 21 8 0.782 22 9 1.307 23 14 2.016 24 13 3.542...
Id x z y A 6 7 3 B 4 4 7 C 10 10 8...
Id x z y A 6 7 3 B 4 4 7 C 10 10 8 D 3 1 4 E 2 3 2 given Ryx= 0.6719 Ryz=0.5190 ssy=26.8 what is the variation in y that is explained by x and z
Id x z y A 6 7 3 B 4 4 7 C 10 10 8...
Id x z y A 6 7 3 B 4 4 7 C 10 10 8 D 3 1 4 E 2 3 2 given Ryx= 0.6719 Ryz=0.5190 ssy=26.8 what is the proportion of variation in y that is explained by x and z
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6...
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6 1 5 6 8 2 4 6 7 3 4 5 9 10 5 8 9 4 7 9 6 7 8 6 How can I detect when 'cin' starts reading from a new line. The amount of numbers in each row is unknown. I need them in type 'int' to use the data. Also, it will be executed like so, "./a.out < sampleInput.txt".
Id x z y A 6 7 3 B 4 4 7 C 10 10 8...
Id x z y A 6 7 3 B 4 4 7 C 10 10 8 D 3 1 4 E 2 3 2 given Ryx= 0.6719 Ryz=0.5190 ssy=26.8 1. what is the variation in y that is redundantly explained by x and z 2. What is the proportion of variation in y that is redundantly explained by x and z
Calculate the correlation​ coefficient, r, for the data below. x 3 5 12 9 7 6...
Calculate the correlation​ coefficient, r, for the data below. x 3 5 12 9 7 6 8 10 11 4 y -3 -1 16 8 5 1 6 10 13 -1
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT