similar to: predict.tree

Displaying 20 results from an estimated 10000 matches similar to: "predict.tree"

2002 Jan 12
2
Bug in predict(newdata=x) with poly() (PR#1258)
Bug in predict.lm & poly The predict function doesn't work when used with poly and newdata. For example, I'd expect the following code to work, and plot a fitted cubic to the nearly straight line: x <- 1:10 y <- x + rnorm(10)/100 plot(x,y) fit <- lm(y ~ poly(x,3)) newx <- seq(1,10,len=100) lines(newx,predict(fit,newdata=data.frame(x=newx))) However, the plotted
2013 Nov 14
1
issues with calling predict.coxph.penal (survival) inside a function
Thanks for the reproducable example. I can confirm that it fails on my machine using survival 2-37.5, the next soon-to-be-released version, The issue is with NextMethod, and my assumption that the called routine inherited everything from the parent, including the environment chain. A simple test this AM showed me that the assumption is false. It might have been true for Splus. Working this
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
2002 Mar 29
1
memory error with rpart()
Dear all, I have a 100 iteration loop. Within each loop, there are some calls to rpart() like: ctl <- rpart.control(maxcompete=0, maxsurrogate=0, maxdepth=10) temp <- rpart(y~., x, w=wt, method="class", parms=list(split="gini"), control=ctl) res <- log(predict.rpart(temp, type="prob")) newres <- log(predict.rpart(temp, newdata=newx,
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 >
2005 Jul 08
1
help with ARIMA and predict
I'm trying to do the following out of sample regression with autoregressive terms and additional x variables: y(t+1)=const+B(L)*y(t)+C(1)*x_1(t)...+C(K)*x_K(t) where: B(L) = lag polynom. for AR terms C(1..K) = are the coeffs. on K exogenous variables that have only 1 lag Question 1: ----------- Suppose I use arima to fit the model:
2013 Mar 01
1
predict.loess() segfaults for large n?
Hi, I am segfaulting when using predict.loess() (checked with r62092). I've traced the source with the help of valgrind (output pasted below) and it appears that this is due to int overflow when allocating an int work array in loess_workspace(): liv = 50 + ((int)pow((double)2, (double)D) + 4) * nvmax + 2 * N; where liv is an (global) int. For D=1 (one x variable), this overflows at
2013 May 17
2
zigzag confidence interval in a plot
Dear All, When I plot the values and linear regression line for one data set, it is fine. But for another one I see zigzags, when I plot the confidence interval >cd Depth CHAOsep12RNA 9,94 804 25,06 1476,833333 40,04 1540,561404 50,11 1575,166667 52,46 349,222222 54,92 1941,5 57,29 1053,507042 60,11 1535,1 70,04 2244,963303 79,97 1954,507042 100,31 2679,140625 >
2006 Sep 28
2
safe prediction from lm
I am fitting a regression model with a bs term and then making predictions based on the model. According to some info on the internet at http://www.stat.auckland.ac.nz/~yee/smartpred/DummiesGuide.txt there are some problems with using predict.lm when you have a model with terms such as bs,ns,or poly. However when I used one of the examples they said would illustrate the problems I get virtually
2013 Feb 12
0
error message from predict.coxph
In one particular situation predict.coxph gives an error message. Namely: stratified data, predict='expected', new data, se=TRUE. I think I found the error but I'll leave that to you to decide. Thanks, Chris ######## CODE library(survival) set.seed(20121221) nn <- 10 # sample size in each group lambda0 <- 0.1 # event rate in group 0 lambda1 <- 0.2 # event rate in group 1
2005 Nov 09
2
help with legacy R code
Hi there, Could somebody help me disect this legacy R script I inherited at work, I have two questions: 1. I've tried to upgrade our R version from 1.6.2 (yeah, I know), to R 2.0, but some of the lines in this script are not compatible with R 2.0, could someone help me figure out where the problem is? 2. the jpeg generated (attached) seems to be off on some of the data, is there a better way
2011 Nov 01
1
predict for a cv.glmnet returns an error
Hi there, I am trying to use predict() with an object returned by cv.glmnet(), and get the following error: no applicable method for 'predict' applied to an object of class "cv.glmnet" What's wrong? my code: x=matrix(rnorm(100*20),100,20) y=rnorm(100) cv.fit=cv.glmnet(x,y) predict(cv.fit,newx=x[1:5,]) coef(cv.fit) Thanks so much, Asaf -- View this message in context:
2012 Sep 04
1
predict rpart newdata - introduce only values variables used in the tree
Dear community, I've a tree which included at first 23 variables. Then I've pruned this tree, and there are only 8 variables involved. I'd like to predict and only introduce in newdata the values of these 8 variables involved. However, as the tree was built with the 23, it asked me for 15 values, even if it doesn't need them. Is there a way to introduce only this 8 values?
2010 Mar 27
5
producing a QQ plot.
Hello everyone I'm a beginner in Stats and R, I'm using R 2.10.1. I need to create a multivariate qq plot, there is 8 variable group with each has 55 number of input. An example of what I did so far, just to get my point out: > data=read.csv(file.choose(),header=T) > data country village group av_expen P2ary_ed no_fisher 1 Cook Islands Aitutaki D
2009 Sep 01
1
understanding the output from gls
I'd like to compare two models which were fitted using gls, however I'm having trouble interpreting the results of gls. If any of you could offer me some advice, I'd greatly appreciate it. Short explanation of models: These two models have the same fixed-effects structure (two independent, linear effects), and differ only in that the second model includes a corExp structure for
2010 Jul 29
1
Using 'dimname names' in aperm() and apply()
I think that the "dimname names" of tables and arrays could make aperm() and apply() (and probably some other functions) easier to use. (dimname names are, for example, created by table() ) The use would be something like: -- x <-table( from=sample(3,100,rep=T), to=sample(5,100,rep=T)) trans <- x / apply(x,"from",sum) y <- aperm( trans,
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
2012 Mar 21
2
glmnet: obtain predictions using predict and also by extracting coefficients
All, For my understanding, I wanted to see if I can get glmnet predictions using both the predict function and also by multiplying coefficients by the variable matrix. This is not worked out. Could anyone suggest where I am going wrong? I understand that I may not have the mean/intercept correct, but the scaling is also off, which suggests a bigger mistake. Thanks for your help. Juliet Hannah
2004 Oct 25
1
Ref: Variable scope or function behaviour or array reassign
Dear R- helpers Following a draft structure of the R script for which I am facing problem Step 1 x <- of type array with original values y <- of type array with original values Step 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
2009 Sep 22
1
odd (erroneous?) results from gls
A couple weeks ago I posted a message on this topic to r-help, the response was that this seemed like odd behavior, and that I ought to post it to one of the developer lists. I posted to r-sig-mixed-models, but didn't get any response. So, with good intentions, I decided to try posting once more, but to this more general list. The goal is (1) FYI, to make you aware of this issue, in case it