similar to: help understanding why #function(x, y) (if((x-y)>=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should

Displaying 20 results from an estimated 20000 matches similar to: "help understanding why #function(x, y) (if((x-y)>=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should"

2012 Mar 10
1
How to improve the robustness of "loess"? - example included.
Hi, I posted a message earlier entitled "How to fit a line through the "Mountain crest" ..." I figured loess is probably the best way, but it seems that the problem is the robustness of the fit. Below I paste an example to illustrate the problem: tmp=rnorm(2000) X.background = 5+tmp; Y.background = 5+ (10*tmp+rnorm(2000)) X.specific = 3.5+3*runif(1000);
2008 Mar 12
4
Distances between two datasets of x and y co-ordinates
Hi all I am trying to determine the distances between two datasets of x and y points. The number of points in dataset One is very small i.e. perhaps 5-10. The number of points in dataset Two is likely to be very large i.e. 20,000-30,000. My initial approach was to append the first dataset to the second and then carry out the calculation: dists <- as.matrix(dist(gis data from 2 * datasets))
2013 Feb 18
2
error: Error in if (is.na(f0$objective)) { : argument is of length zero
Dear all, I tried running the following syntax but it keeps running for about 4 hours and then i got the following errors: Error in if (is.na(f0$objective)) { : argument is of length zero In addition: Warning message: In is.na(f0$objective) : is.na() applied to non-(list or vector) of type 'NULL' Here is the syntax itself: library('nloptr') library('pracma') #
2010 Apr 29
1
Request - adding recycled "lwd" parameter to polygon
Hello dear members of R-help and R-core mailing list, I am not sure if this request is a "ticket" that should be filled somewhere outside the mailing list. If so, I apologize for not doing and would like to know where I should have filled it. And to the subject matter: I would like to use a command like this: plot(c(1,8), 1:2, type="n") polygon(1:7, c(2,1,2,NA,2,1,2),
2010 Apr 29
1
Request - adding recycled "lwd" parameter to polygon
Hello dear members of R-help and R-core mailing list, I am not sure if this request is a "ticket" that should be filled somewhere outside the mailing list. If so, I apologize for not doing and would like to know where I should have filled it. And to the subject matter: I would like to use a command like this: plot(c(1,8), 1:2, type="n") polygon(1:7, c(2,1,2,NA,2,1,2),
2008 Apr 03
3
summary(object, test=c("Roy", "Wilks", "Pillai", ....) AND ellipse(object, center=....)
Dear All, I would be very appreciative of your help with the following 1). I am running multivariate multiple regression through the manova() function (kindly suggested by Professor Venables) and getting two different answers for test=c("Wilks","Roy","Pillai") and tests=c("Wilks","Roy",'"Pillai") as shown below. In the
2005 May 04
3
Multivariate multiple regression
I'd like to model the relationship between m responses Y1, ..., Ym and a single set of predictor variables X1, ..., Xr. Each response is assumed to follow its own regression model, and the error terms in each model can be correlated. My understanding is that although lm() handles vector Y's on the left-hand side of the model formula, it really just fits m separate lm models. What should
2012 Mar 16
1
multivariate regression and lm()
Hello, I would like to perform a multivariate regression analysis to model the relationship between m responses Y1, ... Ym and a single set of predictor variables X1, ..., Xr. Each response is assumed to follow its own regression model, and the error terms in each model can be correlated. Based on my readings of the R help archives and R documentation, the function lm() should be able to
2018 Feb 25
3
include
Thank you Jim, I read the data as you suggested but I could not find K1 in col1. rbind(preval,mydat) Col1 Col2 col3 1 <NA> <NA> <NA> 2 X1 <NA> <NA> 3 Y1 <NA> <NA> 4 K2 <NA> <NA> 5 W1 <NA> <NA> 6 Z1 K1 K2 7 Z2 <NA> <NA> 8 Z3 X1 <NA> 9 Z4 Y1 W1 On Sat, Feb 24, 2018 at 6:18 PM, Jim
2004 Sep 22
3
loops: pasting indexes in variables names
I cannot figure out how, using R, I can paste indexes or characters to the variable names which are used within loops. I will explain this with a simple example: Immagine I have a huge series of variables, each one taken two times, say x1 x2 y1 y2 z1 z2..... Now, immagine that I want to compute a variable from the difference of each couple, say dx=x1-x2, dy=y1-y2, dz=z1-z2... In Stata, for
2007 Oct 17
3
how to repeat the results of a generated probabilities
hello, I want to simulate 200 times the mean of a joint probability (y1) and 200 times the mean of another joint distribution (y2), that is I'm expecting to get 200 means of y1 and 200 means of y2. y1 and y2 are probabilities that I calculate from the marginal prob. (z1 and z2 respectively) multiple by the conditional prob. (x1 and x2 respectively), which I generaterd from the binomial
2010 Nov 20
2
How to do a probability density based filtering in 2D?
Hello, This sounds like a problem to which many solutions should exist, but I did not manage to find one. Basically, given a list of datapoints, I'd like to keep those within the X% percentile highest density. That would be equivalent to retain only points within a given line of a contour plot. Thanks to anybody who could let me know which function I could use! Best, Emmanuel
2007 Dec 06
2
How can I plot this graph
Hi, I am having trouble plotting the graph I need given the follow kind of data > xxx <- data.frame( "x"=c(1,2,3,4,5), "y1"=c(2,4,3,5,6), "y2"=c(3,4,6,3,1), "y3"=c(1,3,5,7,3), "z1"=c(1,NA,3,5,NA), "z2"=c(2,NA,4,6,NA) ) > xxx x y1 y2 y3
2018 Feb 25
2
include
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 col3 1 X1 0 0 2 K1 0 0 3 Y1 0 0 4 W1 0 0 6 K2 X1
2018 Feb 25
0
include
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) preval<-data.frame(Col1=val23[-napos],
2013 Jan 25
2
Pass vector as multiple parameters (as in python f(*x))
Hi, I want to know if it's possible to pass a vector v=c(x,y,...) to a function f(x,y,...) so that each vector element corresponds to a formal argument of the function. For python programmers: f(*v). Specifically, what I'm trying to achieve is: given a list of coordinates l=list(c(x1,y1,z1), c(x2,y2,z2),...) I would like to obtain the corresponding elements in some array A (3-dim in this
2002 May 30
2
Systems of equations in glm?
I have a student that I'm encouraging to use R rather than SAS or Stata and within just 2 weeks he has come up with a question that stumps me. What does a person do about endogeneity in generalized linear models? Suppose Y1 and Y2 are 5 category ordinal dependent variables. I see that MASS has polr for estimation of models like that, as long as they are independent. But what if the
2017 Jun 25
2
Writing my 3D plot function
Hi all,I had a question last week on asking for a function that will help me draw three different circles on x,y,z axis based on polar coordinates (Each X,Y,Z circle are coming from three independent measurements of 1-360 polar coordinates). It turned out that there ?is no such function in R and thus I am trying to write my own piece of code that hopefully I will be able to share. I have spent
2018 Mar 08
3
add single points to a level plot
Hi all, I'm trying to add single points with known coordinates to a level plot, but could not find the proper answer. I got to know that layer() function is good for this, but I don't know which package is related to this function. The source is here: https://stackoverflow.com/questions/28597149/add-xy-points-to-raster-map-generated-by-levelplot but my question is a little different as I
2018 Sep 20
4
Bias in R's random integers?
Hello, On Thursday, September 20, 2018 11:15:04 AM EDT Duncan Murdoch wrote: > On 20/09/2018 6:59 AM, Ralf Stubner wrote: > > On 9/20/18 1:43 AM, Carl Boettiger wrote: > >> For a well-tested C algorithm, based on my reading of Lemire, the > >> unbiased "algorithm 3" in https://arxiv.org/abs/1805.10941 is part > >> already of the C standard library in