Displaying 20 results from an estimated 159 matches for "newx".
Did you mean:
new
2005 Nov 09
2
help with legacy R code
...x,mean,sd))/ntotal
}
wrong <- scan("wrongrawdata.txt", list(x=0))
wrongfit <- fitdistr(wrong$x, "gamma")
wrongmean <- mean(wrong$x)
wrongshape <- wrongfit[[1]][1]
wrongrate <- wrongfit[[1]][2]
good <- scan("rawdata.txt", list(x=0))
xmin = 0
newx = good$x
xmean = mean(newx)
xmax = max(newx)+0.15
goodhist <- hist(newx, br=seq(from=0,to=xmax,by=0.15), probability=T,
col="lightyellow")
initmean <- (min(newx)+max(newx))/2
totalx <- length(newx)
wrongmeanshift <- wrongmean + 0.2
wrongper <- pgamma(wrongmeanshi...
2008 Dec 28
0
how to calculate DWT maximum decomposition level
...integer number) is calculated.
I tried myself the formula in the on-line documentation but could not get the printed threshold in the error
message.
> X1 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,.7,.9,0,.3)
> X2 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,-.7,.9,0,.3)
> newX <- cbind(X1,X2)
> wt <- dwt(newX, n.levels=5, boundary="periodic", fast=FALSE)
> wt <- dwt(newX,filter="la8",n.levels=6, boundary="periodic", fast=FALSE)
Error in dwt(newX, filter = "la8", n.levels = 6, boundary = "periodic", :
Inv...
2010 Mar 27
5
producing a QQ plot.
...t the mahalanobis before plotting the QQ plot, but the following
error is prompt:
> mah=mahalanobis(data,apply(data,2,mean),var(data))
Error in FUN(x, aperm(array(STATS, dims[perm]), order(perm)), ...) :
non-numeric argument to binary operator
In addition: Warning messages:
1: In mean.default(newX[, i], ...) :
argument is not numeric or logical: returning NA
2: In mean.default(newX[, i], ...) :
argument is not numeric or logical: returning NA
3: In mean.default(newX[, i], ...) :
argument is not numeric or logical: returning NA
4: In mean.default(newX[, i], ...) :
argument is not nume...
2007 May 09
1
predict.tree
...emod<-tree(y~x)
where y is a factor and x is a matrix of numeric predictors. They have
dimensions:
> length(y)
[1] 1163
> dim(x)
[1] 1163 75
I?ve evaluated the tree model and am happy with the fit. I also have a
matrix of cases that I want to use the tree model to classify. Call it
newx:
> dim(newx)
[1] 68842 75
The column names of newx match the column names of x. It seems that
prediction should be straightforward. To classify the first 10 values of
newx, for example, I think I should use:
> predict(treemod, newx[1:10,], type = "class")
However, this retu...
2009 Sep 01
1
understanding the output from gls
...;Correlation:"? At first, I thought that this was
describing possible correlations among the predictor variables, but then I
saw that it also included the model intercept. What do these correlation
value mean?
##More detailed information
##function calls:
sppl.i.xx = gls(all.all.rch~l10area+newx, data = gtemp, method="ML")
sppl.i.ex = gls(all.all.rch~l10area+newx, data = gtemp, method="ML",
correlation = corExp(c(20,.8), form=~x+y|area, nugget=TRUE))
##model summaries
> summary(sppl.i.xx)
Generalized least squares fit by maximum likelihood
Model:...
2008 Apr 21
1
Labelling a secondary axis in R
Hello,
How can I label a secondary axis in R? At the moment it's labelled as
c(-100,200). Obviously I would like it to be more sensible.
Here is the code I am using
newx = -100+37.5*((1:9)-1)
axis(4,at=newx,labels=(newx+100)/3750)
Thanks,
Rob
--
View this message in context: http://www.nabble.com/Labelling-a-secondary-axis-in-R-tp16807708p16807708.html
Sent from the R help mailing list archive at Nabble.com.
2010 Jul 29
1
Using 'dimname names' in aperm() and apply()
...RGIN <- dimnum.from.dimnamename( X,MARGIN ) # this line was added to apply
s.call <- ds[-MARGIN]
s.ans <- ds[MARGIN]
d.call <- d[-MARGIN]
d.ans <- d[MARGIN]
dn.call <- dn[-MARGIN]
dn.ans <- dn[MARGIN]
d2 <- prod(d.ans)
if (d2 == 0L) {
newX <- array(vector(typeof(X), 1L), dim = c(prod(d.call),
1L))
ans <- FUN(if (length(d.call) < 2L)
newX[, 1]
else array(newX[, 1L], d.call, dn.call), ...)
return(if (is.null(ans)) ans else if (length(d.ans) <
2L) ans[1L][-1L] else...
Error with custom function in apply: Error in FUN(newX[, i], ...) : unused argument(s) (newX[, i])
2013 Mar 23
1
Error with custom function in apply: Error in FUN(newX[, i], ...) : unused argument(s) (newX[, i])
...f each row in our function but it will take
several days to complete. The idea is to see if we can use our
function with apply. Basically,
data$Results<-apply(data,1, ColChange, LowLim=data[1],
HighLim=data[2], Vals=data[3:6], NumConsecOut=2)
But we get the following error: ?Error in FUN(newX[, i], ...) : unused
argument(s) (newX[, i])?
Any idea about this error or an alternative way to obtain the results
we look for.
Thank you very much,
Camilo
################# Our function is: #######################
ColChange <- function(LowLim, HighLim, Vals, NumConsecOut) {
cols <...
2009 Dec 10
0
Detectar outliers en un gráfico de dispersión SOLUCION
...9;bottomright' ,legend=rownames(data), pch=rang, col='black', cex=.7)
title(main='IUB (abk-cmj)/cmj *100 (XY)',
sub=paste('correlation:',cor(serie0,serie1)), cex.sub=0.75,
font.sub=3, col.sub='grey30')
mylm<-lm(serie1~serie0)
abline(mylm,col="red")
newx<-seq(min(serie0),max(serie0),length.out=length(serie0))
prd<-predict(mylm,newdata=data.frame(serie0=newx),interval =
c("confidence"), level = 0.90,type="response")
lines(newx,prd[,3],col="red",lty=2)
lines(newx,prd[,2],col="red",lty=2)
text(newx[1],pr...
2008 Jun 17
1
Trouble with FUN(newX[, i], ...)
...4000
columns. While running svm function I am ending up with the following error.
trainfile <- read.csv('0_train_0016435.csv',head=TRUE,na.strings = "NULL")
datatrain <- subset(trainfile,select=c(-Class))
model <- svm(datatrain, kernel="radial")
Error in FUN(newX[, i], ...) : 'x' is empty
I tried substituting "NULL" strings in the data with some numeric values but
still I am ending up with error as:
model <- svm(datatrain, kernel="radial")
Error in FUN(newX[, i], ...) : missing observations in cov/cor
In addition: Warning me...
2017 Sep 26
2
Surprising message "Error in FUN(newX[, i], ...) : all arguments must have the same length"
I am hitting an odd message "Error in FUN(newX[, i], ...) : all arguments must have the same length". I can't supply the data as it's a huge data frame but I think this has enough diagnostic information to show the issue. I am sure I am missing something obvious. I've put some extra comments in but otherwise this is cut and...
2006 Sep 28
2
safe prediction from lm
...as bs,ns, and poly
automatically? I am using R 2.3.0
this is their example:
n <- 100
set.seed(86) # For reproducibility of the random numbers
x <- sort(runif(n))
y <- sort(runif(n))
fit <- lm(y ~ bs(x, df=5))
plot(x, y,col="blue")
lines(x, fitted(fit), col="black")
newx <- seq(0, 1, len=n)
points(newx, predict(fit, data.frame(x=newx)), type="l", col=red, err=-1)
thanks,
Spencer
[[alternative HTML version deleted]]
2017 Sep 26
0
Surprising message "Error in FUN(newX[, i], ...) : all arguments must have the same length"
Hi Chris,
Maybe the na.rm=TRUE is affecting things. Try this
apply(datTAF[,75:78],2,function(x){ sum(!is.na(x)) })
HTH,
Eric
On Tue, Sep 26, 2017 at 9:53 AM, Chris Evans <chrishold at psyctc.org> wrote:
> I am hitting an odd message "Error in FUN(newX[, i], ...) : all arguments
> must have the same length". I can't supply the data as it's a huge data
> frame but I think this has enough diagnostic information to show the
> issue. I am sure I am missing something obvious. I've put some extra
> comments in but otherw...
2005 May 06
4
Choices from a matrix
Could someone please suggest a more clever solution to the following problem than my loop below?
Given X a 2xN matrix X, and I a k-subset of N,
Generate the (2^k)xN matrix Y with columns not in I all zero and the other columns with all choices of an entry from the first or second row of X.
For example, with
X <- matrix(1:8, nrow=2)
I <- c(1,3)
X is
1 3 5 7
2 4 6 8
and Y should be
1 0 5
2012 Mar 12
1
2 images on one plot
Dear all
with image I can plot only one set of values in one plot.
Do somebody have any insight how to put those 2 matrices into one picture
so that in one cell in image picture are both values from mat[1,1] and
mat2[1,1].
mat<-matrix(1:4, 2,2)
mat2<-matrix(4:1,2,2)
x <-1:2
y <-1:2
image(x, y, mat)
image(x, y, mat2)
The only way I found is to mix x or y for both matrices let
2004 Oct 25
1
Ref: Variable scope or function behaviour or array reassign
...2
for (ctr in 1:10) {
# my problem here the both x and y still show the original values from step 1
# in spite of making changes to the old values of the arrays x and y in the function
function (x,y) ???
}
step3
output < - function(parX,parY){
Variables for New X and Y
newx <- array(parX, dim=c(1,length(parX)))
newy <- array(parY, dim=c(1,length(parY)))
# make some calculation and updated some arrays element in the newX and # #newY
# finally assign the global original values x and y with newX and newY...
2010 Aug 13
2
Unable to retrieve residual sum of squares from nls output
Colleagues,
I am using "nls" successfully (2.11.1, OS X) but I am having difficulties retrieving part of the output - residual sum of squares. I have assigned the output to FIT:
> > FIT
> Nonlinear regression model
> model: NEWY ~ PMESOR + PAMPLITUDE * cos(2 * pi * (NEWX - POFFSET)/PERIOD)
> data: parent.frame()
> PMESOR PAMPLITUDE POFFSET
> 1153.02 -1183.09 24.58
> residual sum-of-squares: 1815056
>
> Number of iterations to convergence: 8
> Achieved convergence tolerance: 1.643e-08
As you can see, the object cont...
2012 Dec 03
2
Different results from random.Forest with test option and using predict function
Hello R Gurus,
I am perplexed by the different results I obtained when I ran code like
this:
set.seed(100)
test1<-randomForest(BinaryY~., data=Xvars, trees=51, mtry=5, seed=200)
predict(test1, newdata=cbind(NewBinaryY, NewXs), type="response")
and this code:
set.seed(100)
test2<-randomForest(BinaryY~., data=Xvars, trees=51, mtry=5, seed=200,
xtest=NewXs, ytest=NewBinarY)
The confusion matrices for the two forests I thought would be the same by
virtue of the same seed settings, but they differ as do the...
2009 Mar 21
2
limiting simulated animal movement
Hi,
I am trying to simulate animal movement in a gridded landscape made up of
cells. At each time step (iteration), the animal moves from one cell to
another in a random fashion.
This is how I am simulating movement, where a and b are the x,y co-ordinates
of the animal at the previous time step:
for (i in 1:no.of.steps){
direction <- sample(1:8, 1)
if(direction == 1){
a <- a
b <- b -
2006 Sep 22
4
Creating Movies with R
...time<-5 # time extent
tsteps<-501 # time steps
newtime<-seq(0,time,len=tsteps)
#### Now the things specific for the dynamics along x
lam1<- -beta/2*(1+sqrt(1+4*St))
lam2<- -beta/2*(1-sqrt(1+4*St))
xmin<- -0.5
xmax<-0.5
x0<-0.1
vx0<-x0
nx<-101 ## grid intervals along x
newx<-seq(xmin,xmax,len=nx) # grid along x
# M1 <- do.call("g", c(list(x = newx), mypar))
mypar<-c(q,lam1,lam2)
sig_xx<-do.call("sigma_pos",c(list(t=newtime),mypar))
mypar<-c(lam1,lam2,x0,vx0)
exp_x<-do.call("expect_position",c(list(t=newtime),mypar))...