楼主: liulubucm
1419 0

R矩阵在winbugs中如何设定? [推广有奖]

  • 0关注
  • 0粉丝

大专生

46%

还不是VIP/贵宾

-

威望
0
论坛币
19 个
通用积分
0
学术水平
0 点
热心指数
1 点
信用等级
0 点
经验
793 点
帖子
33
精华
0
在线时间
44 小时
注册时间
2011-12-21
最后登录
2019-1-9

受到警告 楼主
liulubucm 发表于 2013-7-16 11:20:15 |AI写论文
提示: 受到警告  Imasasor 违反论坛规定,请发到R专版 2013-7-16 22:34

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

一下程序在winbugs中定义矩阵,Problem 1是例子。

Problem 1:

Utility specifications

U1 = a1 + b11*x11+b12*x12+ b21*x21+b22*x22;      

U2 = a2;

U3 = 0;

有多少产品和自变量?

prods<-3:   产品是三个 U1 U2 U3

atts2<-4   # 4independent variables  : x11 x1 x21 x22

以下程序在定义自变量和Z矩阵。

# Sets Up Independent Variable Matrices (You don’t changethis part)

A2<-c(1:(Obs*atts2))

dim(A2)<-c(Obs,atts2)

# Dummies referencing for which products these areattributes (You don’t change this part)

z<-c(1:(prods*atts2))

dim(z)<-c(prods,atts2)

z<-0*z

# Product Attributes (You change this part)

A2[1:Obs,1]<-(MyData$x11[1:Obs])

A2[1:Obs,2]<-(MyData$x12[1:Obs])

A2[1:Obs,3]<-(MyData$x21[1:Obs])

A2[1:Obs,4]<-(MyData$x22[1:Obs])

# Set Indicator Variables for which products are affiliatedwith each attribute (You change this part)

z[1,1]<-1  # x11

z[1,2]<-1  # x12

z[1,3]<-1  # x21

z[1,4]<-1  # x22


问题是:problem2-problem5如何定义??????????

Problem 2:

Utility specifications

U1 = a1 + b11*x11+b12*x12;

U2 = a2 + b21*x21+b22*x22;

U3 = 0;

How many product choices andindependent variables?  

prods<-3

atts2<-4

What is the correct way to set up A2and z?  

# Sets Up IndependentVariable Matrices (You don’t change this part)

A2<-c(1:(Obs*atts2))

dim(A2)<-c(Obs,atts2)

# Dummies referencing for which products these areattributes (You don’t change this part)

z<-c(1:(prods*atts2))

dim(z)<-c(prods,atts2)

z<-0*z

# Product Attributes (You change this part)

A2

# Set Indicator Variables for which products are affiliatedwith each attribute (You change this part)

z


Problem 3:

Utility specifications

U1 = a1 + b11*x11+b12*x12 + b31*x3;

U2 = a2 + b21*x21+b22*x22 + b32*x3;

U3 = 0;

How many product choices andindependent variables?  


What is the correct way to set up A2and z?  



Problem 4:

Utility specifications

U1 = a1 + b11*x11+b12*x12 + b3*x3;

U2 = a2 + b21*x21+b22*x22 + b3*x3;

U3 = 0;

How many product choices andindependent variables?  


What is the correct way to set up A2and z?  



Problem 5:

Utility specifications

U1 = a1 + b11*x11+b12*x12 + b3*x3;

U2 = a2 + b21*x21+b22*x22 + b3*x3;

U3 = a3 + b3*x3;

U4 = 0;

How many product choices andindependent variables?  


What is the correct way to set up A2and z?  



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:winbugs WINBUG BUGS bug r矩阵 如何

本帖被以下文库推荐

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-21 14:37