search for: approx

Displaying 20 results from an estimated 1583 matches for "approx".

2011 Oct 20
0
Apply approx() to an array and eventually a list of arrays
Hello all, I'm struggling to grasp how I might use lapply() instead of looping to run approx() on a list consisting of multiple arrays - each of equal dimension. But simpler than that, I haven't been able to successfully apply approx() to an array, unless I loop through the third dimension and extract the matrix. See example code below... Any suggestions will be gratefully received. Th...
2011 May 15
5
Question on approximations of full logistic regression model
Hi, I am trying to construct a logistic regression model from my data (104 patients and 25 events). I build a full model consisting of five predictors with the use of penalization by rms package (lrm, pentrace etc) because of events per variable issue. Then, I tried to approximate the full model by step-down technique predicting L from all of the componet variables using ordinary least squares (ols in rms package) as the followings. I would like to know whether I am doing right or not. > library(rms) > plogit <- predict(full.model) > full.ols <- ols(plog...
2007 May 27
1
na.approx and columns with NA's
Hi, I have a object 'zoo': dim(zz) [1] 720 5551 where some columns only have NA's values (representing land data in a sea surface temperature dataset) I find straightforward the use of 'na.approx' for individual columns from the zz matrix, but when applied to the whole matrix: zz.approx<-na.approx(zz) Erro en approx(along[!na], y[!na], along[na], ...) : need at least two non-NA values to interpolate The message is clear, but how do I could skip those 'full-NA's'...
2004 Aug 16
3
bus error /segmentation fault from 'approx' (PR#7177)
Full_Name: joerg van den hoff Version: 1.9.1 OS: MacOS and SunOS Submission from: (NULL) (149.220.4.88) follow up to ID 7166. something like approx(c(1,2),c(NA,NA),1.5,rule=2) crashes 1.9.1 on both systems (MacOS 10.3.5.: bus error, SunOS 5.9: segmentation fault) even if xout is within given x range (as in example above) where rule=2 seems not be relevant anyway.
2019 May 10
0
[R] approx with NAs --> new argument 'na.rm=TRUE' ?!
I have now committed a version "fulfilling" your wish, partly at least, to R-devel . In the new approx(*, na.rm=FALSE) cases, the result of how NA's are treated does depend on the 4 different extrapolation rules {1, 2, 1:2, 2:1} The main reason was that I kept the low level code in C to do +- what it did before which automatically was using 'rule' to determine these results. The he...
2013 Jan 16
1
function approx interpolation of time series data sets
Readers, Am trying to use the function 'approx' to interpolate time series data sets: data1: 01:23:40 5 01:23:45 10 01:23:50 12 01:23:55 7 data2: 01:23:42 01:23:47 01:23:51 01:23:54 The objective is to obtain interpolated values of 'data1' column 2 (5, 10, 12, 7) for the times shown in data2. Tried the following command but recei...
2009 Jul 21
1
bug in approx crashes R
Dear R-devel, The following line crashes R > approx(1, 1, 0, method='const', rule=2, f=0, yleft=NULL, ties='ordered')$y Process R:2 exited abnormally with code 5 at Tue Jul 21 14:18:09 2009 > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status ma...
2019 May 03
2
approx with NAs
There is something I do not think is right in the approx() function in base R, with method="constant" and in the presence of NA values. I have 3.6.0, but the behavior seems to be the same in earlier versions. My suggested fix is to add an "na.rm" argument to approx(), as in mean(). If this argument is FALSE, then NA values should be...
2019 May 03
2
approx with NAs
There is something I do not think is right in the approx() function in base R, with method="constant" and in the presence of NA values. I have 3.6.0, but the behavior seems to be the same in earlier versions. My suggested fix is to add an "na.rm" argument to approx(), as in mean(). If this argument is FALSE, then NA values should be...
2004 Oct 15
1
2d approx
Hi, I am looking for a function that generalizes 'approx' to two (or more) dimensions. The references on the approx help page point toward splines, but a) splines is what I am trying to avoid in the first place and b) splines (except for mgcv splines) seem to be one dimensional. Here is a more detailed account. Using mgcv:gam I fit an additive mode...
2019 May 08
3
[R] approx with NAs --> new argument 'na.rm=TRUE' ?!
>>>>> Robert Almgren >>>>> on Fri, 3 May 2019 15:45:44 -0400 writes [ __ to R-help __ -- here diverted to R-devel on purpose] > There is something I do not think is right in the approx() > function in base R, with method="constant" and in the > presence of NA values. I have 3.6.0, but the behavior > seems to be the same in earlier versions. (of course; the behavior has been unchanged, and "as documented" forever) > My suggested fi...
2012 Oct 12
1
error msg using na.approx "x and index must have the same length"
...79.57 12 C 2012-01-01 13:00:21.847 81.53 13 C 2012-01-01 13:00:21.860 81.53 14 C 2012-01-01 13:00:21.873 NA 15 C 2012-01-01 13:00:43.493 84.69 16 D 2012-01-01 12:01:21.520 24.63 17 D 2012-01-01 12:02:18.880 21.13 I tried the following using na.approx from zoo package interpolatedPrice<-unlist(tapply(portfolio$Price, portfolio$St, na.approx, portfolio$timestamp, na.rm=FALSE)) but keep getting error "Error in na.approx.default(X[[1L]], ...) : x and index must have the same length" I checked the length of every variable in the fo...
2004 Feb 19
1
efficient matrix approx
Hello, I am looking for a highly efficient matrix version of linear interpolation (like approx). As an example I have data like follows: x<-data.frame(time=1:20, x=(1:20)/10, y=runif(20)) t <- seq(1.5, 15.5 ,by=0.5) # and I found the following solution: nam <- names(x) app <- lapply(x[2:3],approx,x=x$time, xout=t) r <- c(1, 2*(1:(ncol(x)-1))) x.new <- as.data.frame(unlis...
2004 Aug 13
2
bus error /segmentation fault from 'approx' (PR#7166)
Full_Name: joerg van den hoff Version: 1.9.0 and 1.7.1 OS: MacOS (1.9.0), SunOS (1.7.1) Submission from: (NULL) (149.220.4.88) something like (sure not the originally intended input, but something like this can happen...): approx(c(1,2),c(NA,NA),1.5) crashes R (bus error under MacOS, segmentation fault under SunOS). search of the bug archive did not work. I hope this bug was not reported already regards joerg
2002 Mar 27
2
Problem with ssh-keygen
...PSTAMP: Steve Christensen INSTDATE: Mar 26 2002 18:15 EMAIL: steve at smc.vnet.net STATUS: completely installed FILES: 25 installed pathnames 2 shared pathnames 4 directories 4 executables 247 blocks used (approx) PKGINST: SMCossh NAME: openssh CATEGORY: application ARCH: sparc VERSION: 3.1p1 BASEDIR: /usr/local VENDOR: The OpenSSH Group PSTAMP: Steve Christensen INSTDATE: Mar 26 2002 18:30 EMAIL: steve at smc.vnet.net STATUS: completely installed F...
2023 Dec 09
1
Linear model and approx function
...redict(lm1, newdata = data.frame(volume = new_volume)) pred_elev The results just estimated for the 159 rows of the dataframe, not the new volume. > tail(pred_elev) 154 155 156 157 158 159 2254.296 2254.296 2254.296 2254.296 2254.296 2254.296 Also I have used the approx function, but it does not work for the new volume, too. > a = x6[,1] > b = x6[,4] > estimate <- 3,000,000,000 > appro <- approx(b,a, xout = estimate) > appro $x [1] 3e+09 $y [1] NA I do not know why it has happened. Is there any way to do this? Or maybe there is another way...
2010 Nov 29
1
Filling in missing time samples with na.approx
...1277648894 0.304075 -0.793544 263 25.237911 103 5 1277648898 0.304085 -0.793455 263 33.322525 108 6 1277648902 0.304064 -0.793387 256 40.042988 115 As you can see, the samples have irregular holes in the time column. How can I fill in the missing samples using na.approx? I've tried to creating a blank series with no gaps and combine them, but "merge" just adds columns and "rbind" compains about duplicate indexes. P.S. My GPS still has holes in the data when I turn off "smart recording" :( Thanks, Jason
2004 Apr 21
2
segfault in approx() (PR#6809)
This is R1.9.0, windows XP I run across the following: It is admittedly silly, but it shouldn't segfault: test <- list(y=1:100, x=rep(NaN, 100)) approx(test, xout=rep(NaN, 10)) Bombs! Kjetil Halvorsen
2003 Jul 24
1
geoR size limit problem
Hi all, I tried to produce some kriged surfaces with geoR (latest version). The size of the grid should be around 900 x 650 cells (what I find is not a very big grid), and the number of points is around 2500. The command krige.conv stopped after arround 5 min saying it can not allocate a vector with around 1.5 billion units. Sounds reasonable. Is there a workaround? How would I partition the
2010 Mar 10
1
pie EPS BB
...d is a file with %%DocumentMedia: special 216 216 0 () () %%BoundingBox: 0 0 216 216 (where of course "216" means 3*72 points = 3 inches), and when this is displayed (using 'gv') I see the pie-chart distinctly offset from the centre of the BoundingBox, with its leftmost point at approx X=84 points from the left of the box (at 0), its rightmost point at X=162 approx 54 points from the right of the box (at 216), so the diameter of the circle is approx 162-84 = 78 points (a bit over 1 inch), and the centre of the circle is approx at 123 points (X) which is 15 points to the right of...