[R] Confidence intervals around the MIC (Maximal information coefficient)
Dear R-Experts, Here below is my R code (reproducible example) to calculate the confidence intervals around the spearman coefficient. ## C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) cor(C,D,method= "spearman") library(boot) myCor=function(data,index){ cor(data[index, ])[1,2] } results=boot(data=cbind(C,D),statistic=myCor, R=2000) boot.ci(results,type="all") ## Now, I would like to calculate the CIs around the MIC (Maximal information coefficient). The MIC can be calculated thanks to the library(minerva). I don’t get the CIs for the MIC, I don’t know how to change my R codes to get the CIs around the MIC. Any help would be highly appreciated : ## library(minerva) mine(C,D) library(boot) myCor=function(data,index){ mic(data[index, ])[1,2] } results=boot(data=cbind(C,D),statistic=myCor, R=2000) boot.ci(results,type="all") ## __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Confidence intervals around the MIC (Maximal information coefficient)
Hello, First of all, when I tried to use function mic I got an error. mic(cbind(C, D)) Error in mic(cbind(C, D)) : could not find function "mic" So I've changed your function myCor and all went well, with a warning relative to BCa intervals. myCor <- function(data, index){ mine(data[index, ])$MIC } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") Hope this helps, Rui Barradas On 12/10/2017 3:19 PM, varin sacha via R-help wrote: Dear R-Experts, Here below is my R code (reproducible example) to calculate the confidence intervals around the spearman coefficient. ## C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) cor(C,D,method= "spearman") library(boot) myCor=function(data,index){ cor(data[index, ])[1,2] } results=boot(data=cbind(C,D),statistic=myCor, R=2000) boot.ci(results,type="all") ## Now, I would like to calculate the CIs around the MIC (Maximal information coefficient). The MIC can be calculated thanks to the library(minerva). I don’t get the CIs for the MIC, I don’t know how to change my R codes to get the CIs around the MIC. Any help would be highly appreciated : ## library(minerva) mine(C,D) library(boot) myCor=function(data,index){ mic(data[index, ])[1,2] } results=boot(data=cbind(C,D),statistic=myCor, R=2000) boot.ci(results,type="all") ## __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Confidence intervals around the MIC (Maximal information coefficient)
Hi Rui, Many thanks. The R code works BUT the results I get are quite weird I guess ! MIC = 0.2650 Normal 95% CI = (0.9614, 1.0398) The MIC is not inside the confidence intervals ! Is there something wrong in the R code ? Here is the reproducible example : ## C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) library(minerva) mine(C,D)$MIC library(boot) myCor <- function(data, index){ mine(data[index, ])$MIC } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") ## De : Rui Barradas roject.org> Envoyé le : Dimanche 10 décembre 2017 16h34 Objet : Re: [R] Confidence intervals around the MIC (Maximal information coefficient) Hello, First of all, when I tried to use function mic I got an error. mic(cbind(C, D)) Error in mic(cbind(C, D)) : could not find function "mic" So I've changed your function myCor and all went well, with a warning relative to BCa intervals. myCor <- function(data, index){ mine(data[index, ])$MIC } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") Hope this helps, Rui Barradas On 12/10/2017 3:19 PM, varin sacha via R-help wrote: > Dear R-Experts, > > Here below is my R code (reproducible example) to calculate the confidence > intervals around the spearman coefficient. > > ## > C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) > D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) > cor(C,D,method= "spearman") > library(boot) > myCor=function(data,index){ > cor(data[index, ])[1,2] > } > results=boot(data=cbind(C,D),statistic=myCor, R=2000) > boot.ci(results,type="all") > ## > > > Now, I would like to calculate the CIs around the MIC (Maximal information > coefficient). The MIC can be calculated thanks to the library(minerva). I > don’t get the CIs for the MIC, I don’t know how to change my R codes to get > the CIs around the MIC. Any help would be highly appreciated : > > ## > library(minerva) > mine(C,D) > library(boot) > myCor=function(data,index){ > mic(data[index, ])[1,2] > } > results=boot(data=cbind(C,D),statistic=myCor, R=2000) > boot.ci(results,type="all") > ## > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Confidence intervals around the MIC (Maximal information coefficient)
You need: myCor <- function(data, index){ mine(data[index, ])$MIC[1, 2] } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") Look at the differences between: mine(C, D) and mine(cbind(C, D)) The first returns a value, the second returns a symmetric matrix. Just like cor() David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of varin sacha via R-help Sent: Sunday, December 10, 2017 11:07 AM To: Rui Barradas ; R-help Mailing List Subject: Re: [R] Confidence intervals around the MIC (Maximal information coefficient) Hi Rui, Many thanks. The R code works BUT the results I get are quite weird I guess ! MIC = 0.2650 Normal 95% CI = (0.9614, 1.0398) The MIC is not inside the confidence intervals ! Is there something wrong in the R code ? Here is the reproducible example : ## C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) library(minerva) mine(C,D)$MIC library(boot) myCor <- function(data, index){ mine(data[index, ])$MIC } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") ## De : Rui Barradas roject.org> Envoyé le : Dimanche 10 décembre 2017 16h34 Objet : Re: [R] Confidence intervals around the MIC (Maximal information coefficient) Hello, First of all, when I tried to use function mic I got an error. mic(cbind(C, D)) Error in mic(cbind(C, D)) : could not find function "mic" So I've changed your function myCor and all went well, with a warning relative to BCa intervals. myCor <- function(data, index){ mine(data[index, ])$MIC } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") Hope this helps, Rui Barradas On 12/10/2017 3:19 PM, varin sacha via R-help wrote: > Dear R-Experts, > > Here below is my R code (reproducible example) to calculate the confidence > intervals around the spearman coefficient. > > ## > C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) > D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) > cor(C,D,method= "spearman") > library(boot) > myCor=function(data,index){ > cor(data[index, ])[1,2] > } > results=boot(data=cbind(C,D),statistic=myCor, R=2000) > boot.ci(results,type="all") > ## > > > Now, I would like to calculate the CIs around the MIC (Maximal information > coefficient). The MIC can be calculated thanks to the library(minerva). I > don’t get the CIs for the MIC, I don’t know how to change my R codes to get > the CIs around the MIC. Any help would be highly appreciated : > > ## > library(minerva) > mine(C,D) > library(boot) > myCor=function(data,index){ > mic(data[index, ])[1,2] > } > results=boot(data=cbind(C,D),statistic=myCor, R=2000) > boot.ci(results,type="all") > ## > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] MSVAR model
> On Dec 9, 2017, at 8:51 PM, ah a via R-help wrote: > > Hello, > > As I'm interested to search about the monetary transmission channel in our > country by MSVAR model,Could you do me favor and tell me How I can run > different types of MSVAR model (such as MSIAH(2)-VAR(2)) and finding > impulse response function in different regimes and also variance > decomposition? This is uncomfortably close to an existing fortune: fortunes::fortune("brain surgery") Why don't you read the Posting Guide. Then perhaps you can improve your question? -- David. > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Confidence intervals around the MIC (Maximal information coefficient)
Hi David, Rui, Thanks for your precious responses. It works ! Best, De : David L Carlson .pt> Cc : "r-help@r-project.org" Envoyé le : Dimanche 10 décembre 2017 19h05 Objet : RE: [R] Confidence intervals around the MIC (Maximal information coefficient) You need: myCor <- function(data, index){ mine(data[index, ])$MIC[1, 2] } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") Look at the differences between: mine(C, D) and mine(cbind(C, D)) The first returns a value, the second returns a symmetric matrix. Just like cor() David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of varin sacha via R-help Sent: Sunday, December 10, 2017 11:07 AM To: Rui Barradas ; R-help Mailing List Subject: Re: [R] Confidence intervals around the MIC (Maximal information coefficient) Hi Rui, Many thanks. The R code works BUT the results I get are quite weird I guess ! MIC = 0.2650 Normal 95% CI = (0.9614, 1.0398) [[elided Yahoo spam]] Is there something wrong in the R code ? Here is the reproducible example : ## C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) library(minerva) mine(C,D)$MIC library(boot) myCor <- function(data, index){ mine(data[index, ])$MIC } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") ## De : Rui Barradas roject.org> Envoyé le : Dimanche 10 décembre 2017 16h34 Objet : Re: [R] Confidence intervals around the MIC (Maximal information coefficient) Hello, First of all, when I tried to use function mic I got an error. mic(cbind(C, D)) Error in mic(cbind(C, D)) : could not find function "mic" So I've changed your function myCor and all went well, with a warning relative to BCa intervals. myCor <- function(data, index){ mine(data[index, ])$MIC } results=boot(data = cbind(C,D), statistic = myCor, R = 2000) boot.ci(results,type="all") Hope this helps, Rui Barradas On 12/10/2017 3:19 PM, varin sacha via R-help wrote: > Dear R-Experts, > > Here below is my R code (reproducible example) to calculate the confidence > intervals around the spearman coefficient. > > ## > C=c(2,4,5,6,3,4,5,7,8,7,6,5,6,7,7,8,5,4,3,2) > D=c(3,5,4,6,7,2,3,1,2,4,5,4,6,4,5,4,3,2,8,9) > cor(C,D,method= "spearman") > library(boot) > myCor=function(data,index){ > cor(data[index, ])[1,2] > } > results=boot(data=cbind(C,D),statistic=myCor, R=2000) > boot.ci(results,type="all") > ## > > > Now, I would like to calculate the CIs around the MIC (Maximal information > coefficient). The MIC can be calculated thanks to the library(minerva). I > don’t get the CIs for the MIC, I don’t know how to change my R codes to get > the CIs around the MIC. Any help would be highly appreciated : > > ## > library(minerva) > mine(C,D) > library(boot) > myCor=function(data,index){ > mic(data[index, ])[1,2] > } > results=boot(data=cbind(C,D),statistic=myCor, R=2000) > boot.ci(results,type="all") > ## > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] file creating
I am using R(3.4.3), Win 7(extreme edition) 32 bit, I have 10 excel files data1,xls, data2.xls .. till data10.xls. I want to create 10 dataframes . How to do ? regards Parth [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] file creating
You could loop over the file names, read each excel file and store the individual data frames in a list using lapply. I prefer to read excel files with the package readxl. The code could be along the lines of library(readxl) my_files <- c("file1", "file2") lapply(my_files, read_excel) HTH Ulrik Partha Sinha schrieb am Mo., 11. Dez. 2017, 08:13: > I am using R(3.4.3), Win 7(extreme edition) 32 bit, > I have 10 excel files data1,xls, data2.xls .. till data10.xls. > I want to create 10 dataframes . How to do ? > regards > Parth > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.