Quantcast

Independent samples bootstrapped T-test : question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Independent samples bootstrapped T-test : question

Tahereh Dehdarirad
Dear R group,

I have some question regarding bootstrapping in R. I wish to use
independent samples bootstrapped T-test. I would like to know: 1 how  I can
 calculate p and t values.2. for means and CI of each sample, should I
report the bootstrapped mean and CI of each group? and not the ones
obtained from t-test?

I used the following code with regard to t-test (t value and p value), So,
I wonder if it is correct with regard to t and p values?

AVGMR=Names_first_last$`Avg_ Readars-Mendeley`

B      <- 1000
t.star = numeric(B)
 t.vect <- vector(length=B)
p.vect <- vector(length=B)
for(i in 1:B){ boot.c <- sample(subset(AVGMR, Gender==1), replace=T)
boot.c <- sample(subset(AVGMR, Gender==2), replace=T)
ttest  <- t.test(boot.c, boot.p)
   t.vect[i] <- ttest$statistic
   p.vect[i] <- ttest$p.value
 }

I would be really grateful if you could please help me with regard to my
both questions.

Kind regards,

Tahereh Dehdarirad, PhD
Department of Library and Information Science
University of Barcelona, Spain

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Independent samples bootstrapped T-test : question

Bert Gunter-2
This is really a statistical question and not about R, and purely
statistical questions are typically off topic here. I note that there
is a "boot" package that you may wish to consider, and searching on
"bootstrapping" on rseek.org -- which you should always do before
posting here -- produced what looked like a number of relevant hits.
Otherwise, try posting your question on stats.stackexchange.com, which
*is* concerned with statistical issues.

Cheers,
Bert




Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Feb 11, 2017 at 3:55 AM, Tahereh Dehdarirad <[hidden email]> wrote:

> Dear R group,
>
> I have some question regarding bootstrapping in R. I wish to use
> independent samples bootstrapped T-test. I would like to know: 1 how  I can
>  calculate p and t values.2. for means and CI of each sample, should I
> report the bootstrapped mean and CI of each group? and not the ones
> obtained from t-test?
>
> I used the following code with regard to t-test (t value and p value), So,
> I wonder if it is correct with regard to t and p values?
>
> AVGMR=Names_first_last$`Avg_ Readars-Mendeley`
>
> B      <- 1000
> t.star = numeric(B)
>  t.vect <- vector(length=B)
> p.vect <- vector(length=B)
> for(i in 1:B){ boot.c <- sample(subset(AVGMR, Gender==1), replace=T)
> boot.c <- sample(subset(AVGMR, Gender==2), replace=T)
> ttest  <- t.test(boot.c, boot.p)
>    t.vect[i] <- ttest$statistic
>    p.vect[i] <- ttest$p.value
>  }
>
> I would be really grateful if you could please help me with regard to my
> both questions.
>
> Kind regards,
>
> Tahereh Dehdarirad, PhD
> Department of Library and Information Science
> University of Barcelona, Spain
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Independent samples bootstrapped T-test : question

Jim Lemon-4
In reply to this post by Tahereh Dehdarirad
Hi Tahereh,
In the code you provided, there seems to be a mistake in the calls to
"sample" in that you haven't specified the "size" argument. You should
have gotten an error there. Also, you have assigned both samples to
the same variable name, so there will be no "boot.p" when the call to
t-test is made, leading to another error message. As Bert said, have a
look at the "boot" function in the "boot" package. This is probably
what you are attempting.

Jim


On Sat, Feb 11, 2017 at 10:55 PM, Tahereh Dehdarirad <[hidden email]> wrote:

> Dear R group,
>
> I have some question regarding bootstrapping in R. I wish to use
> independent samples bootstrapped T-test. I would like to know: 1 how  I can
>  calculate p and t values.2. for means and CI of each sample, should I
> report the bootstrapped mean and CI of each group? and not the ones
> obtained from t-test?
>
> I used the following code with regard to t-test (t value and p value), So,
> I wonder if it is correct with regard to t and p values?
>
> AVGMR=Names_first_last$`Avg_ Readars-Mendeley`
>
> B      <- 1000
> t.star = numeric(B)
>  t.vect <- vector(length=B)
> p.vect <- vector(length=B)
> for(i in 1:B){ boot.c <- sample(subset(AVGMR, Gender==1), replace=T)
> boot.c <- sample(subset(AVGMR, Gender==2), replace=T)
> ttest  <- t.test(boot.c, boot.p)
>    t.vect[i] <- ttest$statistic
>    p.vect[i] <- ttest$p.value
>  }
>
> I would be really grateful if you could please help me with regard to my
> both questions.
>
> Kind regards,
>
> Tahereh Dehdarirad, PhD
> Department of Library and Information Science
> University of Barcelona, Spain
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Loading...