[R] Bivariate Uniform distribution

2010-02-16 Thread li li
Hi all, Is there a function in R to calculate the probability, or quantile, or generate random numbers, and so on for bivariate uniform distribution, like for the bivariate normal distribution? Thanks! Hannah [[alternative HTML version deleted]] ___

[R] Inverse function

2010-02-24 Thread li li
Hi all, I have a function like the following: f <- function(r, y){r/(2*pi)*exp(1)^(-y)*(1+r*(y/2)+r^(2)*(y-1)^(2)/6)} For fixed r, I want to find the inverse funtion in terms y. In other words, for fixed r, if the value of the function is given, I want to find the corrsponding y value th

Re: [R] Inverse function

2010-02-24 Thread li li
; > > Bert Gunter > Genentech Nonclinical Biostatistics > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On > Behalf Of li li > Sent: Wednesday, February 24, 2010 12:46 PM > To: r-help > Subject: [R] Inverse

[R] integration function

2010-03-01 Thread li li
Hi all, I have some problem regarding the integration function. Can any one take a look at the following and give me some help? Thank you in advance! Hannah ## f0 is a function of r,x, and y f0 <- function(r, x, y){ pnorm((x-sqrt(r)*y)/sqrt(1-r), mean=0,sd=1, lower.tail=

[R] minimization function

2010-04-10 Thread li li
Hi all, I am trying to minimize the quardratic form w'Aw, with certain constraints. In particular, (1) A=(a_{ij}) is n by n matrix and it is symmetric positive definite, a_{ii}=1 for all i; and 0=0 Analytically, for n=2, it is easy to come up with a result. For larger n, it

Re: [R] minimization function

2010-04-10 Thread li li
Hi, thanks for the reply. A will be a given matrix satisfying condition 1. I want to find the vector w that minimizes the quadratic form. w satisfies condition 2. 2010/4/10 Paul Smith > On Sat, Apr 10, 2010 at 5:13 PM, Paul Smith wrote: > >>I am trying to minimize the quardratic form w'

Re: [R] minimization function

2010-04-11 Thread li li
agrangian [1] 4.5 0.0 0.0 0.6 $iact [1] 1 4 2010/4/10 Gabor Grothendieck > Check out the quadprog package. > > On Sat, Apr 10, 2010 at 5:36 PM, li li wrote: > > Hi, thanks for the reply. > > A will be a given matrix satisfying condition 1. I want to find

Re: [R] minimization function

2010-04-11 Thread li li
> Add meq=1 to the arguments. > > On Sun, Apr 11, 2010 at 9:50 AM, li li wrote: > > Hi, thank you very much for the reply! > > > > Consider minimize quadratic form w'Aw with A be the following matrix. > >> Dmat/2 > > [,1] [,2] [,3] > >

[R] raise a matrix to a power

2010-04-13 Thread li li
Hi all, I know the operator %*% can do matrix multiplication. Is there a function in R that can raise a matrix to a power? Hannah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://sta

Re: [R] raise a matrix to a power

2010-04-13 Thread li li
Thanks a lot! I found the funciton. Hannah 2010/4/13 Gustaf Rydevik > On Tue, Apr 13, 2010 at 4:58 PM, li li wrote: > > Hi all, > > I know the operator %*% can do matrix multiplication. Is there a > function > > in R that can r

[R] integrate function

2009-12-05 Thread li li
Hello, I have some trouble in terms of using integrate function in R. f1 is a function of p and x where x is supposed to be a vector. (See the code). Then I want to write function f2 which is a function of the vector x after I integrate out p. Can some one give me some help? Many thanks!

Re: [R] integrate function

2009-12-05 Thread li li
object length 2: In (1 - p) * x^{ : longer object length is not a multiple of shorter object length Can any one give me some suggestions! Thank you! 2009/12/5 David Winsemius > > On Dec 5, 2009, at 4:59 PM, li li wrote: > > Hello, >> I have some trouble in terms of using integ

Re: [R] integrate function

2009-12-05 Thread li li
__ > > Ravi Varadhan, Ph.D. > Assistant Professor, > Division of Geriatric Medicine and Gerontology > School of Medicine > Johns Hopkins University > > Ph. (410) 502-2619 > email: rvarad...@jhmi.edu > > > - Original Message - >

[R] Evaluation error

2009-12-06 Thread li li
Hello, I want to write a function calculating posterior probability. Can anyone help have a look at the following program? Here function f is what I eventually need. It is related to function f1, f2 and f3. The argument x is a vector. I get evaluation errors here. Thank you very much! > f1

[R] Help in R

2009-12-14 Thread li li
Hello, Can anyone give me some suggestion in term of calculating the sum below. Is there a function in R that can help doing it faster? x1, x2, ...xn where xi can be 0 or 1. I want to calculate the following: sum{ beta[a+sum(xi), b+n-sum(xi) ]* [ (1-x1)dnorm(0,1)+x1dnorm(2,1) ]* [ (1-x2)dnorm

Re: [R] Help in R

2009-12-15 Thread li li
> > then the sum is > > sum(beta(a + x, b + 1 - x) * ((1 - x) * dnorm(x, 0, 1) + x * dnorm(x, 2, > 1)) > > > More below...HTH > Dennis > > On Mon, Dec 14, 2009 at 6:38 PM, li li wrote: > >> Hello, >> Can anyone give me some suggestion in term of calcu

Re: [R] Help in R

2009-12-15 Thread li li
), orep) : invalid 'times' value In addition: Warning message: In rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) : NAs introduced by coercion Is there a way to correct it? Thank you. 2009/12/15 Charles C. Berry > On Tue, 15 Dec 2009, li li wrote: > > Hi: >

[R] quantile of a mixture of bivriate normal distributions

2009-06-09 Thread li li
Hi, Does anyone know how to compute the quantile of a mixture of four bivariate normal distriutions? Many thanks! Hannah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.

[R] Quantiles for bivariate normal distribution

2009-03-29 Thread li li
Hi, Does anyone know how to write a R function to solve the quantile c for the following equation. P(Z1>1.975, Z2c, Z2>c)=0.05/6. Z1 and Z2 have a bivariate normal distribution with mean 0, variance 1 and correlation 0.5. Thanks a lot! Hannah [[alternative HTML version deleted]

Re: [R] Quantiles for bivariate normal distribution

2009-03-29 Thread li li
ook at packages mnormt and mvtnorm. > > > Best, > Dimitris > > > li li wrote: > >> Hi, >> Does anyone know how to write a R function to solve the quantile c for the >> following equation. >> P(Z1>1.975, Z2c, Z2>c)=0.05/6. >> &g

[R] joint distribution of ordered normal random variables

2009-03-31 Thread li li
Hi Does anyone know whether in R there is a function for the joint distribution of the ordered normal random variables? Thanks a lot! Hannah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz

[R] help with this code

2009-04-19 Thread li li
Hi, can anyone help me with the following code? Thanks! library(mvtnorm) f2 <- function(n, rho) { var <- matrix(c(1,rho,rho,1), nrow=2, ncol=2, byrow=T) beta <- seq(0, 1, length.out=n+1) alpha <- sort (sapply(1-beta, qnorm)) x <- array(0, dim=c(n, n)) for (s in 1:n) { for (t in 1:n){

[R] a function

2010-02-05 Thread li li
Dear all, I need to write the following function in R. Can anyone give me some hint? Thank you! Please see the attachment for the function. Hannah question to R-heip.pdf Description: Adobe PDF document __ R-help@r-project.org mailing list https

[R] Bayesian Variance Components Estimation

2013-08-01 Thread li li
Hi all, Does anyone know whether there is an R function available to find the Bayesian variance components estimators for random effects or mixed models? Thank you very much. Hanna [[alternative HTML version deleted]] __ R-help@r-projec

[R] Change color of the boxplot outliers

2013-09-07 Thread li li
Hi all, Is there a way to change the color of the boxplot plots outliers? Thanks. Hanna [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gui

[R] Help on PK.fit

2012-12-22 Thread li li
Dear all, I have a Pharmokinetics data set where single dose is used for several time points on 8 subjects. I wanted to fit a two compartment model on the data set to see whether it is reasonable. This is the first time to analyze a PK data set and am not familar with various concepts in the

[R] Mean according to the combination of two factors

2013-01-11 Thread li li
Dear all, I have a data frame where there are three variables: values, experiment, composite. Values are numerical values. There are 10 levels for the experiment. Within each level of experiment, there are 17 levels of composite. I want to find mean for each combination of levels of the experi

[R] One sided confidence limits for the regression line

2013-01-13 Thread li li
Hi all, I am trying to plot the one-sided confidence limits for the regression line. It seems it is ok to use predict function to compute the two sided confidence limits. Does any one know a easy way to compute the one sided confidence limits? Thank you very much in advance. Hannah [

[R] Confidence intervel for regression line

2013-01-14 Thread li li
Hi all, For the simple linear regression, I want to find the input "x" value so that the lower confidnece limit is a specific number, say 0.2. In other words, I want to find the value of x so that the lower confidence bound crosses the horizontal line 0.2. Is there a simple way (an R funct

[R] Question on "plotCI" function

2013-01-31 Thread li li
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 v

Re: [R] Question on "plotCI" function

2013-02-01 Thread li li
ny plotCI functions in many different packages... which > one are you referring to? Also please construct a reproducible example > illustrating your problem. > > Best, > Ista > > On Thu, Jan 31, 2013 at 11:58 PM, li li wrote: > > Hi all, > >In my plotCI function,

[R] Integration

2013-02-27 Thread li li
Hi all, I defined the function integrand as follows. library(mnormt) integrand <- function (rho, a, b,z, x, y){ Sigma <- matrix(c(1, rho, rho, 1), 2,2) mu <- rep(0,2) f <- pnorm(c((z-a*x)/b, (z-a*y)/b), mu, Sigma)*dnorm(c(0,0), mu, diag(2)) f

[R] Error message

2013-03-05 Thread li li
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 <- matri

[R] plotting

2013-03-14 Thread li li
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 easie

Re: [R] plotting

2013-03-14 Thread li li
-- > > David L Carlson > > Associate Professor of Anthropology > > Texas A&M University > > College Station, TX 77843-4352 > > > > > > > > > >> -Original Message- > >> From: r-help-boun...@r-

[R] "adaptIntegrate" function

2013-03-21 Thread li li
Hi all, it seems that there is problem with function "adaptIntegrate", when the integration limits is infinity. Please see the code below. The second integration does not seem to work. Can anyone familiar with this give some help? Thank you with much. Hanna library(mnormt) library(c

Re: [R] "adaptIntegrate" function

2013-03-21 Thread li li
semi-infinite intervals is > possible by a change of variables." > > > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of li li > Sent: Donnerstag, 21. März 2013 16:10 > To: r-help > Subject: [R] &qu

[R] order statistic of multivariate normal

2013-03-21 Thread li li
Hi all, Is there an R function that computes the probabilty or quantiles of order statistics of multivariate normal? Thank you. Hanna [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] order statistic of multivariate normal

2013-03-22 Thread li li
t; On Thu, Mar 21, 2013 at 02:32:44PM -0700, David Winsemius wrote: >> >>> >>> On Mar 21, 2013, at 1:44 PM, li li wrote: >>> >>> Hi all, >>>> Is there an R function that computes the probabilty or quantiles of >>>> order statistics of mu

Re: [R] order statistic of multivariate normal

2013-03-22 Thread li li
() function in MASS > could be used to simulate the samples. > > Again, corrections appreciated if I am wrong on any of this. > > -- Bert > > > > On Fri, Mar 22, 2013 at 6:31 AM, Ted Harding wrote: > >> On 22-Mar-2013 13:02:25 li li wrote: >> > Thank you

Re: [R] order statistic of multivariate normal

2013-03-22 Thread li li
t; You get to work through the details:-) > > Ranjan > > > > > On Fri, 22 Mar 2013 10:48:06 -0400 li li wrote: > > > Yes. What I meant is "the distribution of order statistics from a > > non-iid sample of a (normal) distribution with specified sample >

[R] lmer with only random effect

2013-04-23 Thread li li
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 fu

[R] how to read numeric vector as factors using read.table.ffdf

2013-05-07 Thread li li
I have a big data set that includes character variables of many different values. I'm trying to use ff to read the data and then use biglm.big.matrix to build linear models. However, since big.matrix will convert all character vectors to factors and the character labels will be lost. I decided to c

[R] How to use big.matrix to read factor columns

2013-05-07 Thread li li
I have a big data set that includes character variables of many different values. I'm trying to read the data as big.matrix and then use biglm.big.matrix to build linear models. However, since big.matrix will convert all character vectors to factors and the character labels will be lost, I decide

[R] simulate from conditional distribution

2012-09-13 Thread li li
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.

[R] Possible Improvement of the R code

2012-09-16 Thread li li
Dear all, In the following code, I was trying to compute each row of the "param" iteratively based on the first row. This likely is not the best way. Can anyone suggest a simpler way to improve the code. Thanks a lot! Hannah param <- matrix(0, 11, 5) colnames(param) <- c("p", "

[R] Math expression in R plot

2012-09-21 Thread li li
Dear all, In my R plot, I would like to add the title as "Estimator vs. Eta", where I want to use the greek letter eta. I was trying to use expression(plain("Estimator vs.") *eta* ). It does not seem to work. Can anyone familiar with this give some help? Thank you very much. Hannah

[R] SAS

2012-09-21 Thread li li
Dear all, Does any one know whether there is a help forum for sas? I know this is not relevant question to ask here but don't know where else to ask. Thank you. Hannah [[alternative HTML version deleted]] __ R-help@r-project.org mailin

[R] Making several plots using a loop function

2014-06-24 Thread li li
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!

[R] Find the number of intersections according factor levels

2012-11-19 Thread li li
Dear all, I have two vectors x and y, both of which are of length 1000. I created a factor as.factor(rep(1:100,each=10)). Now I want to count, for each factor level, the number of intersections between x and y. In other words, I would like to count the number of intersections between x[1:10] a

[R] rsm package

2014-02-07 Thread li li
Hi all, I fit a complete second order model for my response with three predictors. However, the lack of fit of the model is still significant. I wish to add the third order terms also. Is there a way to do that using rsm function? Thanks. Hanna [[alternative HTML version d

[R] Proportional Odds Model

2013-10-25 Thread li li
Hi all, I am trying to perform an ordinal regression using proportional odds model. First I would like to test whether the assumption of proportional odds is supported by the data. I got the following error message when I try to fit one of the relevant models. Can anyone give some suggestions on

[R] help with R

2010-06-12 Thread li li
Hi all, I want to solve the following equation for x with rho <- 0.5 pnorm(-x)*pnorm((rho*dnorm(x)/pnorm(x)-x)/sqrt(1-rho^2))==0.05 Is there a function in R to do this? Thank you very much! Hannah [[alternative HTML version deleted

[R] questions on some operators in R

2010-06-16 Thread li li
Hi all, I have two questions. Can some one give some help? The first question is regarding the pair of operators "&" and "&&". What is the difference between the two? The second question is regarding "<-" and "=". Usually we use "<-" as the assignment operator. I saw some people use "="

Re: [R] questions on some operators in R

2010-06-18 Thread li li
orm(100) ) > And > > mean( z = rnorm(100) ) > > Are even more different. > > > > -- > Gregory (Greg) L. Snow Ph.D. > Statistical Data Center > Intermountain Healthcare > greg.s...@imail.org > 801.408.8111 > > > > -Original Message- > > From: r-h

[R] question in R

2010-06-18 Thread li li
Dear all, I am trying to calculate certain critical values from bivariate normal distribution (please see the function below). m <- 10 rho <- 0.1 k <- 2 alpha <- 0.05 ## calculate critical constants cc_z <- numeric(m) var <- matrix(c(1,rho,rho,1), nrow=2, ncol=2, byrow=T) for (i in 1:m){ if

[R] package 'Biobase'

2010-06-20 Thread li li
Dear all, Does anyone know where to download the package 'Biobase' in R. Thank you! Hannah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

[R] question about a program

2010-06-23 Thread li li
Dear all, I have the following program for a multiple comparison procedure. There are two functions for the two steps. First step is to calculate the critical values, while the second step is the actual procedure [see below: program with two functions]. This work fine. However, However I wan

[R] (no subject)

2010-07-11 Thread li li
Hi all, I want to add the red color under the standard normal curve to the right of 1.96. Can anyone give me a hand? Please see the code below. Thank you. x <- seq(-4, 4, length=100) hx <- dnorm(x) par(pty="s") plot(x, hx, type="l", xlab="z value", ylab="Density", main="density of N(0,1)"

[R] legend in R plot

2010-07-21 Thread li li
Hi all, I am have some difficulty with the legend function. I need to add a legend to describe the different line types in a plot. The legend box is small. It did not include sufficient length of each line type to help distinguish the differnt line types. Is there a way to fix this. Thank y

Re: [R] legend in R plot

2010-07-23 Thread li li
Thank you all for your kind reply and help. I changed the legend function as Mr. Peter Ehlers suggested and the plots look good. Thank you again. Hannah 2010/7/22 Peter Ehlers > On 2010-07-21 22:06, li li wrote: > >> Hi all, >> I am have some difficul

[R] Figures in Latex

2010-07-23 Thread li li
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

[R] extract rows of a matrix

2010-10-12 Thread li li
Hi all, I want to extract every 20th row of a big matrix, say 1 by 1000. What is the simper way to do this? Thank you very much! Hannah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.e

[R] for loop

2010-10-14 Thread li li
Dear all, I have a function f(x) which return a list as result. $T1 [1] 0.03376190 $T2 [1] 0.04725 $T3 [1] 0.3796071 $T4 [1] 0.3713452 $T5 [1] 0.4523651 $T6 [1] 0.4575873 I now find the result for a vector of x values at one time. I want to store the reuslt for each xi value in a column of a

Re: [R] for loop

2010-10-14 Thread li li
Thanks for the kind help! Hannah 2010/10/14 Brian Diggs > On 10/14/2010 2:53 PM, li li wrote: > >> Dear all, >> I have a function f(x) which return a list as result. >> >> $T1 >> [1] 0.03376190 >> $T2 >> [1] 0.04725 >> $T3

[R] help

2010-10-14 Thread li li
Dear all, I have a function f(x) which return a list as result. $T1 [1] 0.03376190 $T2 [1] 0.04725 $T3 [1] 0.3796071 $T4 [1] 0.3713452 $T5 [1] 0.4523651 $T6 [1] 0.4575873 I now find the result for a vector of x values at one time. I want to store the reuslt for each xi value in a column of a

[R] import data from a csv file

2010-05-24 Thread li li
Hi all, I have some trouble reading data from a csv file. I used command "read.delim("clipboard") to read in the data. > aalpha.data <- read.delim("clipboard") > class(aalpha.data) [1] "data.frame" > dim(aalpha.data) [1] 8 25 > colnames(aalpha.data) [1] "X" "V1" "V2" "V3" "V4" "V5"

[R] problem with a function

2010-05-28 Thread li li
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?

Re: [R] problem with a function

2010-05-28 Thread li li
u'll get a satisfactory answer. > > HTH, > Dennis > > On Fri, May 28, 2010 at 6:52 AM, li li wrote: > >> 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

Re: [R] problem with a function

2010-05-28 Thread li li
can take a look. > > Sarah > > On Fri, May 28, 2010 at 10:17 AM, li li wrote: > > Thanks very much for your reply. The function is a bit long. I attached > it. > > > > rho.f () is in second text document. It uses rada1.mnorm() function which > > is contained i

Re: [R] problem with a function

2010-05-28 Thread li li
> var.f() is a complete function, except that m and J are not passed > as arguments. Instead, you rely on them being present in the > calling environment, and that is both dangerous and bad practice. > > Sarah > > On Fri, May 28, 2010 at 12:00 PM, li li wrote: > > I a

Re: [R] problem with a function

2010-05-28 Thread li li
> mis-use as object names, generally without obvious deleterious effects: > > df # the density of the F distribution > c > data > sd > var > names > > >> var.f <- function(rho) { >> (1-rho)*diag(m)+rho*J%*%t(J) >> } >> >> var.f() is a

Re: [R] problem with a function

2010-05-28 Thread li li
Hi Sarah, Thanks for your kind help. I now know where the problem is. Hannah 2010/5/28 Sarah Goslee > My initial guess appears to be right: you're working with something > exceedingly sensitive to floating point precision. You may have to > reconsider your methods. >

Re: [R] problem with a function

2010-05-28 Thread li li
Hi all, Sorry I have too many questions. I could not think of a way to fix problem. Can anyone give some suggestions on fixing this? Hannah 2010/5/28 li li > Hi Sarah, > Thanks for your kind help. I now know where the problem is. >

[R] help for generating data from ar1 like model

2010-06-09 Thread li li
Hi all, I wrote the following function to generate data following a mixture-ar1 model. The model is described as below: theta is a m-vector with each entries identically and independent Bernoulli trials with success probability pi1. x is a m-vector with entries follow a ar1 mod

[R] Problems with tinnR editor

2011-02-13 Thread li li
Hi all, I have some problem with the tinnR editor. At each end of the line, there is a strange symbol and there is a dot between any two words. Does anyone know how to correct this? Thank you very much! Hannah [[alternative HTML version deleted]] ___

[R] Integrate with an indicator function

2011-02-17 Thread li li
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

[R] Integration with an Indicator Function in R

2011-02-17 Thread li li
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)

Re: [R] Integrate with an indicator function

2011-02-17 Thread li li
. Hannah 2011/2/17 Dennis Murphy > Hi Hannah: > > You have a few things going on, but the bottom line is that numer and denom > are both double integrals. > > On Thu, Feb 17, 2011 at 1:06 PM, li li wrote: > >> Hi all, >> I have some some problem with re

[R] question about solving equation using bisection method

2011-02-21 Thread li li
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-p

Re: [R] question about solving equation using bisection method

2011-02-21 Thread li li
t cu <- uniroot(f1, lower =0, upper = 10, tol = 1e-10,p1=0.15,lambda=lam[i])$root x1[i]<- f2(p1=0.15, cl=cl, cu=cu) } x1<=0.05 x1[259] ## x1[259] is the lambda value for f2()=0.05. Thank you very much!! Hannah 2011/2/21 li li > Hi all, > I have the followi

[R] problem in for loop

2011-02-24 Thread li li
Hi all. I was having some trouble with a for loop and I found the problem is the following. Does anyone have some idea why I got the following R result? Since mone is equal to 3, why mu1 only have 2 components? library(MASS) > p0 <- seq(0.1, 0.9,by=0.1) > m <- 10 > > > p0 <- p0[7] > > ## da

[R] question regarding qmvnorm

2011-04-20 Thread li li
Dear all, I wrote the following function previously. It worked fine with the old mvtnorm package. Somehow with the updated package, I got a error message when trying to use the function. I need some help. It is sort of urgent. Can anyone please take a look. The function is the following. Thank

[R] question with uniroot function

2011-09-03 Thread li li
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 <- func

Re: [R] question with uniroot function

2011-09-03 Thread li li
Dear all, I forgot to mention the values for the parameters in the first email. u1 <- -3 u2 <- 4 alpha <- 0.05 p1 <- 0.15 Thank you very much. 2011/9/3 li li > Dear all, >I have the following problem with the uniroot function. I want to find > roots for the fu

[R] (no subject)

2011-09-11 Thread li li
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 pl

[R] Help

2012-06-28 Thread li li
Dear all, I need some help on plotting multiple boxplots on one figure. I have three matrix A, B and C. Each of them is a 1000 by 10 matrix. The 10 columns of all three matrix correspond to the 10 values of the same parameter, say k=1, ..., 10. I want to make a plot where x axis represents di

Re: [R] Help

2012-06-29 Thread li li
Hi Petr, David and John, Thanks for the reply. I am sorry that I did not make it very clear. "One on top of another" may not be the right expression. Actually what I wanted is the second option of David's. There are 10 columns in the plot and, in each column, there are three boxplots. Different c

Re: [R] Help

2012-06-30 Thread li li
The following is what I get when I run the code. > library(ggplot2) Loading required package: reshape Loading required package: plyr Attaching package: 'reshape' The following object(s) are masked from 'package:plyr': rename, round_any Loading required package: grid Loading required packa

Re: [R] Help

2012-06-30 Thread li li
Hi John, It worked. Thanks a lot! Hannah 2012/6/30 John Kane > It looks like we have different versions of software loaded. > I have R version 2.15.0 (2012-03-30) > > My packages. > reshape2_1.2.1 ggplot2_0.9.0 > > Hannah's packages. > R version 2.12.2 (2011-02-25) > quantreg_4.71 SparseM

Re: [R] geom_boxplot

2012-07-01 Thread li li
Also, it is possible to change "ylim" also? 2012/7/1 li li > 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 an

[R] geom_boxplot

2012-07-01 Thread li li
Dear all, I have a few questions regarding the boxplot output from the "geom_boxplot" function. Take as an example the output of the below: library(ggplot2) p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot(aes(fill = factor(am))) Here are my questions: 1. How can I define the xlab

[R] integration function

2011-06-25 Thread li li
Hi all, Can anyone please take a look at the following two functions. The answer does not seem to be right. Thank you very much! f1 <- function(x) {integrand <- function (x, mu){ dnorm(x, mean=mu, sd=1)*dnorm(mu, mean=2, sd=1) } integrate(in

Re: [R] integration function

2011-06-26 Thread li li
dnorm(x, mean=mu, sd=1)*mu^2*dnorm(mu, mean=2, sd=1) } integrate(integrand, -Inf, Inf,x)$val } 2011/6/25 Peter Ehlers > On 2011-06-25 08:48, li li wrote: > >> Hi all, >>Can anyone please take a look at the following two fun

Re: [R] integration function

2011-06-26 Thread li li
Peter, Thank you very much! 2011/6/26 Peter Ehlers > On 2011-06-26 06:34, li li wrote: > >> Thank you all for the answering. >> Sorry I did not state the problem clearly. I want to take the >> integration with respect to mu, not x. >> For example, f1 should h

[R] image function

2012-07-22 Thread li li
Dear all, I have a question regarding changing the xlim and ylim in the function image(). For example, in the following code, how can I have a heatmap with xlim=ylim=c(0, 100) instead of (0,1). Thank you very much. x <- matrix(rnorm(1, 0,1), 100, 100) image(x) Hannah

[R] density

2012-07-25 Thread li li
Hi all, I have a question regarding the density function which gives the kernel density estimator. I want to decide the bandwidth when using gaussian kernel, given a set of observations. I am not familiar with different methods for bandwidth determination. Below are the different ways in R on

Re: [R] density

2012-07-26 Thread li li
M University > College Station, TX 77843-4352 > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > > project.org] On Behalf Of Michael Young > > Sent: Wednesday, July 25, 2012 9:53 PM > > To: li li > > Cc: r-h

[R] Overlay Histogram

2012-08-06 Thread li li
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

Re: [R] Overlay Histogram

2012-08-07 Thread li li
Thanks a lot. Hannah 2012/8/6 R. Michael Weylandt > See > > example(layout) > > for one idea. I think you might also want to look into rug plots. > > Best, > Michael > > On Mon, Aug 6, 2012 at 2:40 PM, li li wrote: > > Dear all, > > For two sets

<    1   2   3   >