Displaying 20 results from an estimated 10000 matches similar to: "Integration of two dimension function"
2012 Sep 13
2
simulate from conditional distribution
Dear all,
Y, X are bivariate normal with all the parameters known.
I would like to generate numbers from the distribution Y | X > c
where c is a constant.
Does there exist an R function generating
random numbers from such a distribution?
Thank you very much.
hannah
[[alternative HTML version deleted]]
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:
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,
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)
2011 Feb 17
1
Integration with an Indicator Function in R
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 <-
2012 Feb 18
3
R help
Dear all,
I need to generate numbers from multivariate normal with large dimensions
(5,000,000).
Below is my code and the error I got from R. Sigma in the code is the
covariance
matrix. Can anyone give some idea on how to take care of this error. Thank
you.
Hannah
> m <- 5000000
> m1 <- 0.5*m
> rho <- 0.5
> Sigma <- rho* matrix(1, m, m)+diag(1-rho, m)
2018 Feb 06
2
question with integrate function
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 from the plot, it is not
shown to be monotone. Something wrong with the usage of integrate function?
Thanks so much for your help.
Hanna
h <- function(c){
g <- function(x){pnorm(x-8.8,
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 Sep 11
3
(no subject)
Dear all,
Can anyone take a look at my program below?
There are two functions: f1 (lambda,z,p1) and f2(p1,cl, cu).
I fixed p1=0.15 for both functions. For any fixed value of lambda (between
0.01 and 0.99),
I solve f1(p1=0.15, lambda=lambda, z)=0 for the corresponding cl and cu
values.
Then I plug the calculated cl and cu back into the function f2.
Eventually, I want to find the lambda value
2012 Jul 01
4
geom_boxplot
Also, it is possible to change "ylim" also?
2012/7/1 li li <hannah.hlx@gmail.com>
> Dear all,
> I have a few questions regarding the boxplot output from the
> "geom_boxplot" function.
> Attached is the output I get. Below are my questions:
>
> 1. How can I define the xlab and ylab myself?
> Also I would like to remove
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,
2007 Mar 02
3
Reformulated matrices dimensions limitation problem
First I wanted to thank both Marc Schwartz Greg Snow and for their reply.
Then I needed to add a level of complexity to the problem.
I would be able to create the biggest possible matrix.
In other way does it exist a method to ask smthing like the following :
max number of rows for a matrix if column=x?
Thank you
------------------------------------------------------
Passa a Infostrada.
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
2012 Mar 23
3
R numerical integration
Hi all,
Is there any other packages to do numerical integration other than the
default 'integrate'?
Basically, I am integrating:
integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value
The integration is ok provided sigma is >0.
However, when mu=-1.645074 and sigma=17535.26
It stopped working. On the other hand, Maple gives me a value of
0.5005299403.
It is an
2012 Aug 06
4
Overlay Histogram
Dear all,
For two sets of random variables, say, x <- rnorm(1000, 10, 10) and y
<- rnorm(1000. 3, 20).
Is there any way to overlay the histograms (and density curves) of x and y
on the plot of y vs. x?
The histogram of x is on the x axis and that of y is on the y axis.
The density curve here is to approximate the shape of the distribution
and does not have to have area 1.
Thank you
2012 Aug 07
2
Rcolorbrewer Package
Hi all,
I am trying to download the Rcolorbrewer package from Cran
http://cran.r-project.org/web/packages/RColorBrewer//index.html
It seems the files have been removed. Does anyone know where can
I download the package?
Thanks.
Hannah
[[alternative HTML version deleted]]
2010 Jul 23
3
Figures in Latex
Hi all,
I want to add 6 plots in the format of 2 columns and 3 rows as one
figure in latex. The plots are in .eps file.
I know how to add 2 plots side by side, but could not figure out how to do
multiple rows.
I know this may not be the right place to ask such a question. But I do
not know who to ask, so just try my
luck here.
Thank you in advance.
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
2010 May 28
2
problem with a function
Hi all,
I have a function rho.f which gives a list of estimators. I have the
following problems.
rho.f(0.3) gives me the right answer. However, if I use rho.f(corr[4]) give
me a different
answer, even though corr[4]==0.3.
This prevents me from using a for loop. Can someone give me some help?
Thank you very much in advance.
Hannah
>