[R] Confidence Interval

rak1304 rkeyes87 at hotmail.com
Sun Jan 18 04:13:35 CET 2009


Yes it is a homework problem, I included the whole question as I thought it
would make it easier to explain however I am unsure of how to do the
confidence interval part.  As far as I am aware I have set up a matrix with
my 100 samples of 100 and have calculated means.  Do I need to set up a new
matrix of these means and then do a confidence interval from there? Also
when I searched 'confint' in R I am confused as to how to adapt it to my
problem.

I am looking for the interval of each individual mean plus or minus 1.96/10

I wasnt aware of abs(x) and sum(means>0) so thankyou for pointing them out
to me.




Ben Bolker wrote:
> 
> Rachel Keyes <rkeyes87 <at> hotmail.com> writes:
> 
>> 
>> 
>> I am new to R and Im some trouble with the following question... Generate
>> 100
> standard normal N(0,1) samples
>> of size 100, X1(k),...,X100(k)  where k=1,...,100 (The k is and indicie
>> in
> brackets) Calculate the sample
>> mean for each sample. For each sample mean Xbark the 0.95-confidence
>> interval
> for the mean mew=0 is given
>> by... Ik= ( Xbark plus or minus 1.96/10) Find the number of intervals
>> such
> that 0 does not belong to Ik.  How
>> many of them do you expect to see? Well so far I have come up with...
>> N<-100;
> Nsamp<-100
>> A<-matrix(rnorm(N*Nsamp,0,1),ncol=Nsamp) means<-apply(A,2,mean) However I
>> have
> no idea what I am
>> doing and no idea if that even makes sense. Any help would be greatly
> appreciated as I have no experience of
>> statistical software whatsoever. Thanks in Advance. Rachel
>> 
> 
>   This sounds an awful lot like a homework problem.
> Can you convince us not by giving us a little more context?
> 
> I will say that you seem to have made a pretty good start.
> A hint is that if you have a logical condition,
> sum(condition) will count the number of cases. For
> example, sum(means>0) will count the number of positive
> means.  ?abs and ?">" may help too.
> 
>  By the way, I think that's supposed to be "mu" and not "mew".
> 
>   Ben Bolker
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Confidence-Interval-tp21523397p21523829.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list