楼主: Lisrelchen
3077 14

R2MLwiN [推广有奖]

11
Lisrelchen 发表于 2013-12-10 00:28:49 |只看作者 |坛友微信交流群
Examples:Draws a sixway plot of MCMC diagnostics.
## Not run:
library(R2MLwiN)
## Modify the following paths as appropriate.
## MLwiN folder
mlwin = "C:/Program Files (x86)/MLwiN v2.27/"
## MLwiN sample worksheet folder
wspath=paste(mlwin,"/samples/",sep="")
## Example: Normal
formula="normexam~(0|cons+standlrt)+(2|cons+standlrt)+(1|cons)"
levID=c('school','student')
estoptions= list(EstM=1,resi.store.levs=2)
wsfile=paste(wspath,"tutorial.ws",sep="")
inputfile=paste(tempdir(),"/tutorial.dta",sep="")
ws2foreign(wsfile, foreignfile=inputfile, MLwiNPath=mlwin)
library(foreign);indata =read.dta(inputfile)
mymodel=runMLwiN(formula, levID, D="Normal", indata, estoptions,MLwiNPath=mlwin)
chain=mymodel["chains"][,"FP_standlrt"]
sixway(chain,"beta_1")
## End(Not run)

使用道具

12
Lisrelchen 发表于 2013-12-10 00:33:33 |只看作者 |坛友微信交流群

Example: Plots MCMC chain trajectories


## Not run:
library(R2MLwiN)
## Modify the following paths as appropriate.
## MLwiN folder
mlwin = "C:/Program Files (x86)/MLwiN v2.27/"
## MLwiN sample worksheet folder
wspath=paste(mlwin,"/samples/",sep="")
## Example: Normal
formula="normexam~(0|cons+standlrt)+(2|cons+standlrt)+(1|cons)"
levID=c('school','student')
estoptions= list(EstM=1)
wsfile=paste(wspath,"tutorial.ws",sep="")
inputfile=paste(tempdir(),"/tutorial.dta",sep="")
ws2foreign(wsfile, foreignfile=inputfile, MLwiNPath=mlwin)
library(foreign);indata =read.dta(inputfile)
mymodel=runMLwiN(formula, levID, D="Normal", indata, estoptions, MLwiNPath=mlwin)
trajectories(mymodel["chains"],Range=c(4501,5000))
## End(Not run)

使用道具

13
Lisrelchen 发表于 2013-12-10 00:35:42 |只看作者 |坛友微信交流群

Example: Converts a categorical variable into several separate binary variables


## Not run:
library(R2MLwiN)
## Modify the following paths as appropriate.
## MLwiN folder
mlwin = "C:/Program Files (x86)/MLwiN v2.27/"
## MLwiN sample worksheet folder
wspath=paste(mlwin,"/samples/",sep="")
wsfile=paste(wspath,"tutorial.ws",sep="")
inputfile=paste(tempdir(),"/tutorial.dta",sep="")
ws2foreign(wsfile, foreignfile=inputfile, MLwiNPath=mlwin)
library(foreign);indata =read.dta(inputfile)
names(indata)
indata=cbind(indata,Untoggle(indata[["school"]],"school"))
names(indata)

## End(Not run)


使用道具

14
Lisrelchen 发表于 2013-12-10 00:52:28 |只看作者 |坛友微信交流群

使用道具

15
958163533 在职认证  发表于 2017-7-23 16:24:05 |只看作者 |坛友微信交流群
多层次 回归模型 全部变量都放进去 不区分 是不是就是最小二成回归

使用道具

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

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-27 17:40