24小时热门版块排行榜    

查看: 1363  |  回复: 3

shy1992331

新虫 (小有名气)

[求助] 新手求问packge手册里的lazydata,linking to,RoxygenNote等是什么意思? 已有1人参与

最近下载了这个package: https://cran.r-project.org/web/packages/MAVE/index.html
想问问大家Reference manual提到的这些描述都是什么意思?
在使用其中的MAVE函数的时候R(version 3.3.3)总是会崩溃,下面是code,麻烦大家帮忙看看时怎么回事。

library(mvtnorm)
library(Rcpp)
library(RcppArmadillo)
library(knitr)
library(MAVE)
n<-400; p<-10       
sigma<-diag(p)
x<-rmvnorm(n,rep(0,p),sigma)
beta1<-c(rep(1,2),rep(0,p-2))
beta2<-c(rep(0,2),rep(1,2),rep(0,p-4))
beta3<-c(rep(0,4),rep(-1,2),rep(0,p-6))
beta4<-c(rep(0,6),1,-1,rep(0,p-8))
beta<-cbind(beta1,beta2,beta3,beta4)
prob<-exp(x%*%beta)
y<-apply(prob,1,which.max)
c1<-which(y==1);n1<-sum(y==1);x1<-x[c1,]
c2<-which(y==2);n2<-sum(y==2);x2<-x[c2,]
c3<-which(y==3);n3<-sum(y==3);x3<-x[c3,]
c4<-which(y==4);n4<-sum(y==4);x4<-x[c4,]
y12<-c(rep(1,n1),rep(2,n2));x12<-rbind(x1,x2)
y13<-c(rep(1,n1),rep(3,n3));x13<-rbind(x1,x3)
y14<-c(rep(1,n1),rep(4,n4));x14<-rbind(x1,x4)
dr12<-MAVE(x12,y12,method="csMAVE" )
theta22<-dr12$dir[[1]]
dr13<-MAVE(x13,y13,method="csMAVE" )
theta33<-dr13$dir[[1]]
dr14<-MAVE(x14,y14,method="csMAVE" )
theta44<-dr14$dir[[1]]
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

匿名

用户注销 (初入文坛)


感谢参与,应助指数 +1
jjdg: 金币+1, 感谢参与 2017-04-07 15:27:51
本帖仅楼主可见
2楼2017-04-07 07:36:51
已阅   申请程序强帖   回复此楼   编辑   查看我的主页

shy1992331

新虫 (小有名气)

引用回帖:
2楼: Originally posted by beihaixi at 2017-04-07 07:36:51
Have you ever installed rtools? If you are using windows system, probably it is caused by the Rcpp related header files.
Try to update your Rtools, and that could be a solution. If that still doesn' ...

I have just begun to learn R so I know very liitle about R. I have install rtools but I don't know  how to use it. What should I do after installing it? Do you have some materials about R for beginners? Thank you very much.
3楼2017-04-07 19:29:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

秋犯

银虫 (正式写手)

good Luck
4楼2017-04-07 21:08:27
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 shy1992331 的主题更新
信息提示
请填处理意见