[R] Fw: Multiple Integrals

2015-08-30 Thread Shant Ch via R-help
the expectation I want to find. On Saturday, August 29, 2015 7:24 PM, David Winsemius wrote: On Aug 29, 2015, at 11:35 AM, Shant Ch via R-help wrote: > Hello Dr. Berry, > > I know the theoretical side but note we are not talking about expectation of > sums rather expectat

Re: [R] Multiple Integrals

2015-08-29 Thread Shant Ch via R-help
Hello Dr. Berry, I know the theoretical side but note we are not talking about expectation of sums rather expectation of ABSOLUTE value of the function (X1/3+X2/3+X3/3-X4), i.e. E|X1/3+X2/3+X3/3-X4| , I don't think this can be handled for log normal distribution by integrals by hand. Shant

[R] Multiple Integrals

2015-08-28 Thread Shant Ch via R-help
Hello all, For a study I want to find E|X1/3+X2/3+X3/3-X4| for variables following lognormal distribution. To get the value we need to use four integrals. This is the code which I is used   fx<-function(x){     dlnorm(x,meanlog=2.185,sdlog=0.562)   } U31<-integrate(function(y1) { sap

[R] rdagum(Library (VGAM))

2013-04-15 Thread Shant Ch
Hello! I am working with a procedure where I need to draw one observation at a time from dagum distribution. I used the function defined in the VGAM library. when I did, rdagum(n=1, 0.2,1,4.5)) it says: Error in qdagum(runif(n), shape1.a = shape1.a, scale = scale, shape2.p = shape2.p)

[R] Efficient method: Equality of all elements of two vectors

2012-10-14 Thread Shant Ch
n=10 x1<-(1:n)/n y1<-rnorm(n,x1^2,1) m=20 x2<-(1:m)/m The value of y2 will be rnorm (m, x2^2,1) if none of the elements of x2 is same as x1, but for every same elements in x1 and x2, the value of y2 will be same as y1. I know the following is correct, but for large vectors, this won't work effi

[R] Solving the equation using uniroot

2012-03-24 Thread Shant Ch
Hello all, I was going to solve (n-m)! * (n-k)! = 0.5 *n! * (n-m-k)! for m when values of n and k are provided n1<-c(10,13,18,30,60,100,500)         # values of n kx<-seq(1,7,1);   # values of k slv2<-lapply(n1,function(n){    slv1<-lapply(kx,function(k){    

[R] Regarding as. Date function

2011-11-20 Thread Shant Ch
Hi all,   I have a data set containing dates in the format of m/d/y starting from 1950. I wanted to use standard format of date R uses. So I read the data set in R and converted it using as.Dates. But for dates from 1950-1968, I have the following problem. as.Date("1/1/50","%m/%d/%y",orig

[R] Neighbouring structure of school districts

2011-07-27 Thread Shant Ch
Hello R Users, I wanted to find the weights and adjacency matrix of texas that can be used in Openbugs. library("spdep") library("maps") library("maptools") tx_shape<-readShapePoly(".\\Districts_10_11.shp") tx_nb<-poly2nb(tx_shape) There is a command called "dnearneigh" in spdep but is no

[R] R code to extract shape polygons for any state for loading into Geobugs

2011-07-10 Thread Shant Ch
Hello R users, I am fitting a spatio-temporal model for the areal data related to school districts of Texas, US using geobugs. For that I need to load the polygon shape file in geobugs.In Bradley Carlin's website there was an S-plus program called poly.S to extract polygons for any state in th

[R] subset from a dataset after comparing its one column to a related vector

2011-07-07 Thread Shant Ch
Hello R users, I have two data sets like the following. Form of dataset: data: X1 X2X3X4 X5 1902 RE3 5949 1903 RE3 13407 1904 AA3 760 14 1908 RE4 1

Re: [R] plotting texas school district using shape files

2011-05-25 Thread Shant Ch
district using shape files Shant Ch yahoo.com> writes: > > Hi, > > I was plotting or creating a map for Texas school districts > using the shape file > of Texas. I could not find any other helpful mail in the mailing list. > > txshp<-read.shape(system.file(&quo

[R] plotting texas school district using shape files

2011-05-24 Thread Shant Ch
Hi, I was plotting or creating a map for Texas school districts using the shape file of Texas. I could not find any other helpful mail in the mailing list. txshp<-read.shape(system.file("S:\\Districts_10_11.shp", package="maptools")) Error- read.shape no found. But read.shape is there in map

Re: [R] density at particular values

2010-11-20 Thread Shant Ch
vid Winsemius Cc: r-help@r-project.org Sent: Sat, November 20, 2010 8:54:32 PM Subject: Re: [R] density at particular values On Nov 20, 2010, at 8:07 PM, Shant Ch wrote: > Hello everyone! > > I want to use density function of R to compute the density at x(=0, say). But >it > is gi

[R] density at particular values

2010-11-20 Thread Shant Ch
Hello everyone! I want to use density function of R to compute the density at x(=0, say). But it is giving me the 5-number summary and mean of the data and densities at that point. I just want the densities at different values specified by me. Can anyone let me know how can I find that? For

[R] Extending the accuracy of exp(1) in R

2010-11-09 Thread Shant Ch
Hi, I want to use a more accurate value of exp(1).  The value given by R is 2.718282. I want a value which has more than 15 decimal places. Can anyone let me know how can I increase the accuracy level. Actually there are some large multipliers of exp(1) in my whole expression, and I want a mor

[R] solving equation consisting of factorials

2010-10-30 Thread Shant Ch
Hi, I was trying to solve for m such that, choose(n-1,k-1)+choose(n-2,k-1)+...+choose(n-m+1,k-1) - ck=0 ck is calculated by the way given in the code. Now I solved for m using uniroot but the error messages appeared. n<-30 k=3 alpha<-0.05 nk<-choose(n,k); ck<-(nk/2)+k*nk*qnorm(1-alpha)/(1

[R] Solving equations involving gamma functions

2010-09-23 Thread Shant Ch
Hi, I want to find a value of n1. I used the following code but I am getting the error - Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any' n=10 a_g<-(1/(n*(n-1)))*((pi/3)*(n+1)+(2*sqrt(3)*(n-2))-4*n+6) a_s<-function(n1) { t1=(n1-1)/2; (t1*(gamma(t1)/g

Re: [R] Recursion problem

2010-08-22 Thread Shant Ch
Thanks Jim. Here are the following details: I need to find the sum, w=n*d1/2, fixed SUM [nCk* g(w,k)*g(w, n-k-1)]. Here the SUM is taken from k=1,2,..,n-1. f1<-exp(-t^2/(2*r*(r+1)))*G(t,r-1) G(x,r)=integrate(f1,0,x), where G(x,0)=1 So, G(x,r) is related to G(x,r-1) by the above relation with

[R] Recursion problem

2010-08-21 Thread Shant Ch
Hi, I wanted to compute the value of the function ifn at certain values of n. But I am receiving the following error when I was using the following code(given at the end). Error: evaluation nested too deeply: infinite recursion / options(expressions=)? I feel that since the function Grx is

[R] handling recursion relation

2010-08-20 Thread Shant Ch
Hi, I wanted to compute the value of the function ifn at certain values of n. But I am receiving the following error when I was using the following code(given at the end). Error: evaluation nested too deeply: infinite recursion / options(expressions=)? I feel that since the function Grx is re

Re: [R] Help in the legend()

2010-07-05 Thread Shant Ch
2)), var(t^(2))-var(t^(1))), var("t^(3))-var(t^(1)) ) ), lty=c(1,2,5)). From: David Winsemius Cc: r-help@r-project.org Sent: Mon, July 5, 2010 9:43:19 PM Subject: Re: [R] Help in the legend() On Jul 5, 2010, at 8:06 PM, Shant Ch wrote: > Hi R-users,

[R] Help in the legend()

2010-07-05 Thread Shant Ch
Hi R-users, I was plotting the differences of the variances of the three estimators- T^(1), T^(2), T^(3), ofcourse taking two at a time. I was using the expression() in the legend function in order to show which line correspond to which of the difference, but the following that I had used didn'

[R] help in expression( )

2010-06-02 Thread Shant Ch
Hi, I was trying to have a graph whose axes are of the following type: X axis: n and Y axis: var[U ((a,b) in suffix, and (n,d) in the power)]. U ((a,b) in suffix, and (n,d) in the power)-U^(n,d) _ (a,b). Actually I require many plots involving different values of a,b,n,d, so need to

[R] code for power and suffix for x,y labels in plot( ).

2010-06-01 Thread Shant Ch
Hi I was trying to have a graph whose axes are X axis: m, Y axis: var[X ((a,b) in suffix, and (n,d) in the power)]. X ((a,b) in suffix, and (n,d) in the power)-X^(n,d) _ (a,b). Actually I require many plots involving different values of a,b,n,d, so need to keep this complicated notat

[R] Warning message

2010-05-09 Thread Shant Ch
Hello, I want to draw a histogram of the mean of sample observations drawn from multivariate t distribution. I am getting the following error corresponding to the code I used. Though I am getting the graph, but I am curious to know the warning message. Warning messages: 1: In if (freq) x$count

[R] Solving equation

2010-04-30 Thread Shant Ch
Hello, I want to solve: x*(3^x)*log(4)-x*log(4/3)-(3^x)+1=0 for x. I used the following code, uniroot(function(x) x*(3^x)*log(4)-x*log(4/3)-(3^x)+1, lower = -2, upper = 2, tol = 0.001 ) While using this I am getting the following error. Can anyone please help me out. Error in uniroot(function