Tipping point code from R to MATLAB
이전 댓글 표시
Hi, I have a R code and SAS code for tipping point analysis. Please help me to do this analysis in MATLAB. https://cran.r-project.org/web/packages/TippingPoint/vignettes/TippingPoint.html Attached is SAS code and the link is from R. I am giving the R code in steps in the following. Please help me out
1. library(TippingPoint)
- Load the dataset
data(tippingdata)
- Show the first 6 rows of the data
head(tippingdata)
## continuous binary educ female treat
## 1 119.7820 1 12 0 1
## 2 117.7729 0 16 0 1
## 3 124.7833 0 12 1 1
## 4 123.3546 0 12 1 1
## 5 124.6611 0 12 1 1
## 6 NA 1 15 0 1
Basic Plot: ## for binary outcome # Using `estimate` TippingPoint(outcome=tippingdata$binary,
treat= tippingdata$treat,group.infor=TRUE,
plot.type = "estimate",ind.values = TRUE,
impValuesT = NA, impValuesC = NA,
summary.type = "density", alpha = 0.95, S=1.5, n.grid = 100,
HistMeanT = c(0.38,0.4), HistMeanC = c(0.2,0.55))
2. # Using `p.value` with formula class
TippingPoint(binary~treat, data=tippingdata,
plot.type = "p.value",ind.values = TRUE,
impValuesT = NA, impValuesC = NA,
summary.type = "density", alpha = 0.95, S=1.5, n.grid = 100,
HistMeanT = c(0.38,0.4), HistMeanC = c(0.2,0.55))
3. # Using `both` TippingPoint(outcome=tippingdata$binary,treat= tippingdata$treat,
plot.type = "both",ind.values = TRUE,
impValuesT = NA, impValuesC = NA,
summary.type = "density", alpha = 0.95, S=1.5, n.grid = 100,
HistMeanT = c(0.38,0.4), HistMeanC = c(0.2,0.55))
4. # for continuous outcome TippingPoint(continuous~treat, data=tippingdata,
group.infor=TRUE, plot.type = "estimate",ind.values = TRUE,
impValuesT = NA, impValuesC = NA,
summary.type = "density", alpha = 0.95, S=1.5, n.grid = 100,
HistMeanT = c(120), HistMeanC = c(131,137))
5. TippingPoint(outcome=tippingdata$continuous,treat= tippingdata$treat,
plot.type = "p.value",ind.values = TRUE,
impValuesT = NA, impValuesC = NA,
summary.type = "density", alpha = 0.95, S=1.5, n.grid = 100,
HistMeanT = c(120), HistMeanC = c(131,137))
6.TippingPoint(outcome=tippingdata$continuous,treat= tippingdata$treat,
plot.type = "both",ind.values = TRUE,
impValuesT = NA, impValuesC = NA,
summary.type = "density", alpha = 0.95, S=1.5, n.grid = 100,
HistMeanT = c(120), HistMeanC = c(131,137))
댓글 수: 4
Stephen23
2017년 11월 8일
@Raisul Islam: what is your question?
Raisul Islam
2017년 11월 8일
편집: Raisul Islam
2017년 11월 8일
Adam
2017년 11월 8일
Time to do some reading and learning in that case! If you have no idea how either language works you won't get very far using the code even if someone does take their own time to convert it all for you! The Matlab help is very good to learn from.
Raisul Islam
2017년 11월 8일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!