similar to: question with integrate function

Displaying 20 results from an estimated 6000 matches similar to: "question with integrate function"

2018 Feb 06
0
question with integrate function
Sorry. I meant in the previous email that the function h() is a monotone decreasing function. Thanks very much. 2018-02-06 13:32 GMT-05:00 li li <hannah.hlx at gmail.com>: > Hi all, > The function h below is a function of c and it should be a monotone > increasing function since the integrand is nonnegative and integral is > taken from c to infinity. However, as we can see
2018 Feb 06
1
question with integrate function
Hi Hanna, your function is essentially zero outside a short interval around 9. And the help page states: "If the function is approximately constant (in particular, zero) over nearly all its range it is possible that the result and error estimate may be seriously wrong." You could try to integrate over a finite interval, say (7, 12). G?ran Brostr?m On 2018-02-06 19:40, li li wrote:
2013 Mar 05
2
Error message
Dear all, I got an error message when running the following code. Can anyone give any suggestions on fixing this type of error? Thank you very much in advance. Hanna > integrand <- function(x, rho, a, b, z){ + x1 <- x[1] + x2 <- x[2] + Sigma <- matrix(c(1, rho, rho, 1), 2,2) + mu <- rep(0,2) + f <-
2013 Mar 14
4
plotting
Hi alL, I have a data frame with 4 columns: "value", "time", "group" and "id". I would like to plot "value" vs. "time" with different colors for different levels of "group" and different symbols for different values of "id". I think I could do this but I would like to see what is an easier way to plot the
2017 Jun 01
2
subletting an array according to dimnames
Hi all, I have a three dimensional array with the corresponding dimension names. I would like to subset the array according to the dimension names. For example, suppose I want to extract the values corresponding to A=20, B=10, C=0. I know I can do: P2[dimnames(P2)$A==20, dimnames(P2)$B==10, dimnames(P2)$C==0] But is there a better way for doing this? Thanks for your help! Hanna >
2014 Jun 24
2
Making several plots using a loop function
Hi all, When making a bunch of plots using a loop function, how to add title to reflect different plots. Specifically, for the code below, I generated 9 plots. I would like to add a title to each plot. For example, the titles will be respectively, plot1, plot 2, … plot 9. Thank you very much! Hanna par(mfrow=c(3,3), pty="s", pch=16, col="blue") for ( i in 1:9) { lm1
2017 Jul 28
3
problem with "unique" function
I have the joint distribution of three discrete random variables z1, z2 and z3 which is captured by "z" and "prob" as described below. For example, the probability for z1=0.46667, z2=-1 and z3=-1 is 2.752e-13. Also, the probability adds up to 1. > head(z) z1 z2 z3 [1,] -0.46667 -1.0000 -1.0000 [2,] -0.33333 -0.9333 -0.9333 [3,] -0.20000 -0.8667 -0.8667
2017 Jun 01
2
Question on function "scatterplot3d"
Hi all, I have a question with regard to making plots using function "scatterplot3d". Please see the example below. It looks like, for y axis, the tickmark text was cutoff. The number "10" does not show up completely. I tried to work with par(mpg). It does not seem to work. Hope to get some advice here. Thanks much! Hanna C <- runif(30) B <- rep(1:3, each=10) A
2017 Jun 02
0
subletting an array according to dimnames
Have you tried P2["20", "10", "0"] ? Jean On Thu, Jun 1, 2017 at 3:10 PM, li li <hannah.hlx at gmail.com> wrote: > Hi all, > I have a three dimensional array with the corresponding dimension names. > I would like to subset the array according to the dimension names. For > example, > suppose I want to extract the values corresponding to A=20,
2011 Sep 03
3
question with uniroot function
Dear all, I have the following problem with the uniroot function. I want to find roots for the fucntion "Fp2" which is defined as below. Fz <- function(z){0.8*pnorm(z)+p1*pnorm(z-u1)+(0.2-p1)*pnorm(z-u2)} Fp <- function(t){(1-Fz(abs(qnorm(1-(t/2)))))+(Fz(-abs(qnorm(1-(t/2)))))} Fp2 <- function(t) {Fp(t)-0.8*t/alpha} th <- uniroot(Fp2, lower =0, upper =1,
2017 Jun 01
0
Question on function "scatterplot3d"
> On 1 Jun 2017, at 03:41, li li <hannah.hlx at gmail.com> wrote: > > Hi all, > I have a question with regard to making plots using function > "scatterplot3d". > Please see the example below. It looks like, for y axis, the tickmark text > was cutoff. > The number "10" does not show up completely. I tried to work with par(mpg). > It does not
2017 Jun 07
3
Adding zeros in each dimension of an array
For a data frame, we can add an additional row or column easily. For example, we can add an additional row of zero and an additional row of column as follows. Is there an easy and similar way to add zeros in each dimension? For example, for array(1:12, dim=c(2,2,3))? Thanks for your help!! Hanna > x <- as.data.frame(matrix(1:20,4,5))> x[5,] <- 0> x[,6] <- 0> x V1 V2
2013 Apr 23
1
lmer with only random effect
Dear all, I want to fit a random effect model with only one random factor. I do not want to include the intercept term either. The model I using now is lmer(values ~ (1|lot), data=tmp) The results are as below. How do I take out the intercept term? Or if this is not possible for the lmer function, is it possible using lme function in the "nlme" package? Thank you very much in
2013 Sep 07
1
Change color of the boxplot outliers
Hi all, Is there a way to change the color of the boxplot plots outliers? Thanks. Hanna [[alternative HTML version deleted]]
2013 Feb 01
1
Question on "plotCI" function
Hi all, In my plotCI function, the argument x is chosen to be seq(0.05, 0.95, by=0.05). However, when I make the plot, the plot has the x coordinate goes 1:19. Does anyone know how to make the x coordinate to be (0,0.5, 0.1, ..., 0.95). Thank you. Hanna [[alternative HTML version deleted]]
2017 Jul 28
0
problem with "unique" function
Most likely, previous computations have ended up giving slightly different values of say 0.13333. A pragmatic way out is to round to, say, 5 digits before applying unique. In this particular case, it seems like all numbers are multiples of 1/30, so another idea could be to multiply by 30, round, and divide by 30. -pd > On 28 Jul 2017, at 17:17 , li li <hannah.hlx at gmail.com> wrote:
2012 Apr 24
2
Some Help Needed
Dear all, I need to do some calculation where the code used are below. I get error message when I choose k to be large, say greater than 25. The error message is "Error in integrate(temp, lower = 0, upper = 1, k, x, rho, m) : the integral is probably divergent". Can anyone give some help on resolving this. Thanks. Hannah m <- 100 alpha <- 0.05 rho <- 0.1 F0
2011 Feb 17
1
Integrate with an indicator function
Hi all, I have some some problem with regard to finding the integral of a function containing an indicator function. please see the code below: func1 <- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star <- function(x){ integrate(func1, lower = 0, upper = Inf,x)$val} T <- function(x){ 0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))} func2 <-
2011 Feb 21
1
question about solving equation using bisection method
Hi all, I have the following two function f1 and f2. f1 <- function(lambda,z,p1){ lambda*(p1*exp(-3*z-9/2)+(0.2-p1)*exp(4*z-8))-(1-lambda)*0.8} f2 <- function(p1,cl, cu){ 0.8*(pnorm(cl)+(1-pnorm(cu)))/(0.8*(pnorm(cl)+(1-pnorm(cu)))+p1*(pnorm(cl+3)+(1-pnorm(cu+3)))+(0.2-p1)*(pnorm(cl-4)+(1-pnorm(cu-4))))}-0.05 First fix p1 to be 0.15. (i) choose a lambda value, say lamda=0.6, (ii)
2017 Oct 30
1
An iterative function
Dear all, The function f() below is a function of m1 and m2, both of which are matrices with 3 rows. The function works sequentially one row after another. So altogether there are three stages. I am trying to update the coding to write a generic function that will work for arbitrary k stages. I am hoping to get some suggestion and help. Thanks so much! Hanna ##x, y are two