Tipping point code from R to MATLAB

조회 수: 13 (최근 30일)
Raisul Islam
Raisul Islam 2017년 11월 8일
편집: Raisul Islam 2017년 11월 8일
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)
  1. Load the dataset
data(tippingdata)
  1. 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
Adam
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
Raisul Islam 2017년 11월 8일
Thank you for your kind advise @adam

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by