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.
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
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
Following is a preview of the matrix x: Code: [,1] [,2] [,3] [1,] 1 3 5...
Following is a preview of the matrix x: Code: [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 Write the code that return the output: [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 [3,] 7 8 9
# of text messages sent yesterday 3 8 3 18 2 1 8 1 6 13...
# of text messages sent yesterday 3 8 3 18 2 1 8 1 6 13 15 14 13 9 20 12 5 9 18 18 13 2 7 6 0 0 11 12 4 13 1 19 4 12 4 11 8 18 1 15 12 6 6 12 19 12 20 12 8 12 Test the following claim: 70% of individuals that send text messages send less than 10 messages per day, α = 0.01
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT