[R] Fw: Multiple Integrals
Thank you very much to all for all your responses. @Dr. Winsemius, E[f(X)] =f(E(X)) if f is convex. Now we know |x| is convex function, so clearly in this scenario if we compute the expectation of the ((X1+X2+X3)/3-X4) and then take the absolute, then, we will get a lower bound of the expectation I want to find. On Saturday, August 29, 2015 7:24 PM, David Winsemius dwinsem...@comcast.net 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 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. To Shnant Ch; I admit to puzzlement (being a humble country doctor). Can you explain why there should be a difference between the absolute value of an expectation for a sum of values from a function, in this case dlnorm, that is positive definite versus an expectation simply of the sum of such values? -- David Winsemius Alameda, CA, USA [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multiple Integrals
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#39;t think this can be handled for log normal distribution by integrals by hand. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Multiple Integrals
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) { sapply(y1, function(y1) { + integrate(function(y2){ sapply(y2, function(y2) { + integrate(function(x1){ sapply(x1, function(x1) { + integrate(function(x2) + abs(y1/3+y2/3+x1/3-x2)*fx(y1)*fx(y2)*fx(x1)*fx(x2),0, Inf)$value + })},0, Inf)$value })},0, Inf)$value})},0,Inf)$value The error I received is the following: Error in integrate(function(y2) { : maximum number of subdivisions reached I can understand the problem, but I am unable to figure out what can be done.. It would be great if you can let me know a solution to the problem so as to find a value for the integral. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rdagum(Library (VGAM))
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) : object 'Scale' not found. In the description of dagum in R website I found that the sample size, n, that we need to draw using this function, should be strictly 1. Can you please let me know what should I do in this case? Thank you very much. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Solving the equation using uniroot
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){ lhs-function(m) { fnk-factorial(n-m)*factorial(n-k)- 0.5*factorial(n-m-k)*factorial(n); return(fnk); } un2-uniroot(lhs,c(0,n)) un1-un2$root/n; return(rbind(un1)); }); rjbk-data.frame(do.call(cbind,slv1)); return(cbind(n,rjbk)); }); rj-data.frame(do.call(rbind,slv2)); rj I used the above code, but I am getting this error, can anyone help me with this. Error in uniroot(lhs, c(0, n)) : f.upper = f(upper) is NA In addition: Warning message: In gamma(x + 1) : NaNs produced Thanks in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Regarding as. Date function
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,origin=1900/01/01) =2050-01-01 instead of 1950-01-01 But for dates 1969 onwards it is working fine. as.Date(1/1/69,%m/%d/%y) = 1969-01-01 Can anyone please help me find out the problem? Thanks Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Neighbouring structure of school districts
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 not useful here as it requires a set of coordinates for the whole data, but tx_shape is giving me coordinates for every district. I don't know what thing I am missing here. I would be glad if anyone can help with this. Shant. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R code to extract shape polygons for any state for loading into Geobugs
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 the United States in the appropriate format for loading into GeoBUGS which is no more now and that too on S. Is there any R code to extract the polygons for all school districts of a state in the United States or something of that type, the format which can be used in geobugs? Bhargab To: r-help@r-project.org Sent: Thu, July 7, 2011 4:40:19 PM Subject: [R] subset from a dataset after comparing its one column to a related vector 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 1759 18 1909 EX2 3871 2901 AU6 31162 3801 AA1 304 29 3902 RE5 24826 I need to select rows of a data set based on the common observations of X1. Using intersect command I got the common observations of X1 from the two data sets as: common=c(1902, 1904, 1908, 1909, 3801). Using subset command I can select portions separately. But in general if I am given this type of dataset - data with large number of rows and also a list of X1 - common containing many elements, can anyone please let me know how to select portion of the data whose X1 values are same as common values. If any questions let me know. Shant. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] subset from a dataset after comparing its one column to a related vector
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 1759 18 1909 EX2 3871 2901 AU6 31162 3801 AA1 304 29 3902 RE5 24826 I need to select rows of a data set based on the common observations of X1. Using intersect command I got the common observations of X1 from the two data sets as: common=c(1902, 1904, 1908, 1909, 3801). Using subset command I can select portions separately. But in general if I am given this type of dataset - data with large number of rows and also a list of X1 - common containing many elements, can anyone please let me know how to select portion of the data whose X1 values are same as common values. If any questions let me know. Shant. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plotting texas school district using shape files
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 maptools. If anyone can help me out it will be great. Thanks in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting texas school district using shape files
Yes I had included the library(maptools) in my code, it is already installed in my computer. but still it is showing the same error. From: Ben Bolker bbol...@gmail.com To: r-h...@stat.math.ethz.ch Sent: Wed, May 25, 2011 8:06:19 AM Subject: Re: [R] plotting texas school district using shape files Shant Ch sha1one at 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(S:\\Districts_10_11.shp, package=maptools)) Error- read.shape no found. But read.shape is there in maptools. A couple of things: that's probably not the *exact* error you got. Did you remember to load the package first with library(maptools) ... ? (You did install the package first, too, right?) After you have done that I suspect you will still have a problem with finding the file -- I think you want something like library(maptools) txtshp - read.shape(S:\\Districts_10_11.shp) Ben Bolker __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] density at particular values
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 example Thanks in advance for your help. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] density at particular values
David, I did look at ?density many times. I think I didn't explain what I have to find. Suppose I have a data. x- c(rnorm(40,5,3),rcauchy(30,0,4),rexp(30,6)) Suppose I don't have information about the mixture, I have been given only the data. density(x) will give the 6 number summary of the data, given as x and also the 6 number summary of the density of density given as y. I want to find the density of the given data at x=1. I basically want the value of y(=density) for x=1 i.e. kernel density at x=1. Shant From: David Winsemius dwinsem...@comcast.net 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 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? Here's what you should have done (even before posting): ?density Read the help page to see the structure of what density() returns. Value x the n coordinates of the points where the density is estimated. y the estimated density values. These will be non-negative, but can be zero. Realize that the specified by me part is either going to be modified to pick an existing estimate near my specification or that you will need to approximate the value. So what is the actual problem (and the actual data setup) ? --David. For example Thanks in advance for your help. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Extending the accuracy of exp(1) in R
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 more accurate result at the last step of my program, and for that I need to use highly accurate value of exp(1). Can anyone help me out? Thanks. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] solving equation consisting of factorials
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)/(12*n)# computation of ck. lhs-function(z) { Smc=0; fnk=0 for(y in 1:z) { fnk[y]-choose((n-y+1),(k-1)) Smc=Smc+fnk[y]-ck } return(Smc); } In order to solve the equation first I tried to find out the point near which lhs=0 using curve function. curve(lhs,-70,-60) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ In addition: Warning message: In 1:z : numerical expression has 101 elements: only the first used Then I computed lhs function for every z one by one, I found that lhs changes its sign between (-64,-63), so I used the following uniroot function. uniroot(lhs(-64,-63)) Error in min(interval) : 'interval' is missing Can anyone help me out? Thanks. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Solving equations involving gamma functions
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)/gamma(n1/2))^2)/2-1-a_g } xm-solve(a_s) Can anyone help me out. Thanks in advance for your help. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Recursion problem
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 the constraint G(x,0)=1. g(x,r)= G(x,r)*exp(-x^2/(2*(r+1))) I have described what I want to do, in the above, if any further details is rquired just let me know. From: jim holtman jholt...@gmail.com Cc: r-help@r-project.org Sent: Sun, August 22, 2010 3:49:50 PM Subject: Re: [R] Recursion problem We replied once that your function Grx is not correct. It will recurse to an infinite depth because there is no condition to end the calls. I would expect that there would be some test at the beginning of the function to see if it should be called again. You need to debug your function, or rewrite to compute what you want. You have not described the problem you are trying to solve, so no solution can be provided. 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 recursively related, perhaps making the code too complicated too handle. Can anyone let me know if there is any other way to handle this problem? d1=10.5 Grx-function(x,r) { G0=Grx(x,0) G0=1; fu1-function(t){exp(-t^2/(2*r*(r+1)))*Grx(x,r-1)} return(integrate(fu1,0,x)$value) } grx-function(x,r) { Grx(x,r)*exp(-x^2/(2*(r+1))) } ifn-function(n) { w=n*d1/2;S1=0; for(k in 1:(n-1)) { S1=S1+choose(n,k)*grx(w,k)*grx(w,n-k-1) } return(S1); } ifn(7) Thanks in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Recursion problem
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 recursively related, perhaps making the code too complicated too handle. Can anyone let me know if there is any other way to handle this problem? d1=10.5 Grx-function(x,r) { G0=Grx(x,0) G0=1; fu1-function(t){exp(-t^2/(2*r*(r+1)))*Grx(x,r-1)} return(integrate(fu1,0,x)$value) } grx-function(x,r) { Grx(x,r)*exp(-x^2/(2*(r+1))) } ifn-function(n) { w=n*d1/2;S1=0; for(k in 1:(n-1)) { S1=S1+choose(n,k)*grx(w,k)*grx(w,n-k-1) } return(S1); } ifn(7) Thanks in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] handling recursion relation
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 recursively related, perhaps making the code too complicated too handle. Can anyone let me know if there is any other way to handle this problem? d1=10.5 Grx-function(x,r) { G0=Grx(x,0) G0=1; fu1-function(t){exp(-t^2/(2*r*(r+1)))*Grx(x,r-1)} return(integrate(fu1,0,x)$value) } grx-function(x,r) { Grx(x)*exp(-x^2/(2*(r+1))) } ifn-function(n) { w=n*d1/2;S1=0; for(k in 1:(n-1)) { S1=S1+choose(n,k)*grx(w,k)*grx(w,n-k-1) } return(S1); } ifn(5) Thanks in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help in the legend()
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't gave desired result. I would be grateful, if you help me out. plot(n, pg, type=l,xlab=n,ylab=Differences of the variances,ylim=c(-0.0012,0.0023), xlim=c(0,60)); lines(gs,lty = 2) lines(ps,lty=5) legend(30, 0.0021, expression( c ( var(t^(3))-var(t^(2)), var(t^(2))-var(t^(1))), var(t^(3))-var(t^(1)) ) ), lty=c(1,2,5)) Thanks. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help in the legend()
Thanks Dr. Winsemius. Here's the toy data set. Basically pg = var(t^(3))-var(t^(2), gs = var(t^(2))-var(t^(1))and ps=var(t^(3))-var(t^(1)). The revised code and the data set is as follows: n-seq(4:13) pg-c(-1.241394e-03, -9.738079e-04, -7.158755e-04, -5.343962e-04, -4.088778e-04, -3.202068e-04, -2.558709e-04, -2.079914e-04, -1.715435e-04, -1.432430e-04) gs-c(0.0022520038, 0.0020060234, 0.0017601434, 0.0015519810, 0.0013810851,0.0012407732, 0.0011245410, 0.0010271681, 0.0009446642, 0.0008740083) ps-c( 0.0010106098, 0.0010322155, 0.0010442678, 0.0010175848, 0.0009722074,0.0009205665, 0.0008686700, 0.0008191768, 0.0007731207, 0.0007307653) plot(n, pg, type=l,xlab=n,ylab=Differences of the variances,ylim=c(-0.0012,0.0023) ); lines(gs,lty = 2) lines(ps,lty=5) legend(30, 0.0021, expression( c ( var(t^(3))-var(t^(2)), var(t^(2))-var(t^(1))), var(t^(3))-var(t^(1)) ) ), lty=c(1,2,5)). From: David Winsemius dwinsem...@comcast.net 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, 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't gave desired result. I would be grateful, if you help me out. plot(n, pg, type=l,xlab=n,ylab=Differences of the variances,ylim=c(-0.0012,0.0023), xlim=c(0,60)); lines(gs,lty = 2) lines(ps,lty=5) legend(30, 0.0021, expression( c ( var(t^(3))-var(t^(2)), var(t^(2))-var(t^(1))), var(t^(3))-var(t^(1)) ) ), lty=c(1,2,5)) Have you consider offering a toy set of objects which defines t, n, and pg. Thanks. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help in expression( )
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 keep this complicated notation. The code I used: plot(n, hn$h_pg, ylab=expression(Var(U[2%,%1]^(n%,%0))-Var(U[1%,%1]^(n%,%0))), xlab=n,type=l); The expression() didn't work out for this case. Can anyone help me out. Also due to the size of the expression in the Y axis, I want to shift the graph in the R Graphics window, so that the Y labels are also fully visible. i don't know such command which will shift the whole graph a little in the Graphics window. Thanks, in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] code for power and suffix for x,y labels in plot( ).
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 notation. The expression() didn't work out for this case. Can anyone help me out. Thanks, in advance. Shant 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(x) x * (3^x) * log(4) - x * log(4/3) - (3^x) + : f() values at end points not of opposite sign. Thanks in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Warning message
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$counts else { : the condition has length 1 and only the first element will be used 2: In if (!freq) Density else Frequency : the condition has length 1 and only the first element will be used --- library(mvtnorm); s12-c(1:1000); var21-lapply(s12,function(x){ rs-rmvt(10, sigma=diag(8), df=1); my-mean(rs); sy-sqrt(var(rs)) return(cbind(my,sy)) }); data1-do.call(rbind,var21); dataMat-data.frame(data1); W-dataMat$my; hist(W,breaks=20,probability=T) --- Thanks. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Solving equation
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(x) x * (3^x) * log(4) - x * log(4/3) - (3^x) + : f() values at end points not of opposite sign. Thanks in advance. Shant [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.