Muhammad Kashif uaf.edu.pk> writes:
>
> Dears
> Can anyone help me to solve the issue.
>
> By using" boot" and "boot.ci" package in R we can construct bootstrap
confidence intervals. How we
> calculate the coverage probability of these intervals.
Calculating coverage probability for any but
Dears
Can anyone help me to solve the issue.
By using" boot" and "boot.ci" package in R we can construct bootstrap
confidence intervals. How we calculate the coverage probability of these
intervals.
[[alternative HTML version deleted]]
__
R-h
Hi,
Some suggestion about the arguments of the function defined below. Since
theta is calculated with the value of lambda1 and lambda2, there is no need
to include theta in the argument. Or, your function can be defined as
function(lambda1, lambda2, significance.level)
cover <- function(theta
Hi,
Given the function cover, it's very likely that you will get 0 for both s1
and s1 with small value of lambda1 and lambda2. In that case the sum s will
be 0. With s being 0, you will have issue with the expression in pi <-
s2/s and root <- ((s2/s)*(1-s2/s)+k/(4*s))^(1/2). You need to take
Hi,
In your function cover, lambda1 and lambda2 are used but not in the
argument of the function. I suppose that you need to have lambda1 and
lambda2 in the argument of the function cover, like function(lambda1,
lambda2, n, significance.level).
Give it a try.
cover <- function(lambda, n,
Hi,
After some thought, I found the treatment of sample mean equal 0 was not
appropriate. I modified the function likelihood.ratio.test.Poisson.
resulting.matrix now has 0.0512 as the average of type I error.
function(lambda, sample.size, significance.level)
{
reject <- 0
sample.mean <- m
Hi,
My first question is what is your n when you say fixed n. I assume the
lambda is the mean of the poisson distribution that you want to take sample
from.
Another question is about the sample size. It does not make too much
sense to make a sample of size 1.
Let's assume that you want t
Hi,
Roughly reading the code, I find this statement "phat <- x / m" is
probably incorrect since this will give you the set of 100 observed x
values /100. I redefine the function cover with three inputs: lambda
for the parameter of the poisson distribution, sample.size and
significance.
Hi hubinho,
This starts to look as homework to me so this will be my last try in
helping you.
The general strategy would be along the lines of (1) write a function that
does what you want for a value of theta and (2) sapply() that function to
the vector of theta values you would like to evaluate:
Thank you very much again. But in this case I get the coverage probability as
an average over all values for the odds ratio.
I need a coverage probability for every value for the odds ratio.
So the coverage probability for odds ratio = 1, than for odds ratio = 2 and
so on.
Sorry to bother you ag
Hi hubinho,
You need to initialize the for() loop and then store the u and l values
properly:
# parameters
n1 <- 10
n2 <- 10
y <- 100
alpha <- 1
z<-1.96
# creating B 2x2 tables
B <- 50
u <- l <- vector('numeric', B)
for (i in 1:B){
theta <- i
x1 <- exp(alpha +theta)/ (1+ exp(alpha +thet
Thank you very much. This was, was i needed. Unfortunately I have one futher
problem with this Code. I don't only need the coverage probability for one
but for a range of different odds ratios. (for example [1;30]). I tried it
with a loop but I get an error. I think again, that I'm almost there but
Hi hubinho,
You are almost there. Try this slightly modification of your function:
# theta, u and l are vectors of the same length
foo <- function(theta, u, l) mean(theta >= l & theta <= u, na.rm = TRUE)
foo(theta, u, l)
HTH,
Jorge.-
On Mon, Mar 19, 2012 at 12:55 PM, hubinho <> wrote:
> Hell
Hello.
I'm allready this far. I have a function which is calculating the lower (l)
and upper (u) limit for a confidence interval for the odds ratio.
For example for 5 simulated 2x2 tables the upper and lower limits are:
> u
[1] 2.496141 7.436524 8.209161 4.313587 3.318612
> l
[1] -0.9718608 1.1
Hello to the members of the list,
I am using the 'spectrum' function from 'stats' package, to calculate
the squared coherency between two time series. The function
'plot.spec.coherency' provides information for the coverage probability
for the normal distribution.
It seems that the calculati
15 matches
Mail list logo