similar to: User defined split function in rpart

Displaying 20 results from an estimated 800 matches similar to: "User defined split function in rpart"

2001 Mar 22
2
Two-argument functions in tapply()
Hello to all. My question is very simple... Let's say we have a data frame with three variables (columns): X, W and F. X is a numeric variable (e.g. like income) F is a factor (e.g. with 2 levels) and W is a case weight (data are from household sample but an individual was interviewed, weights are functions of number of persons in the house hold). I wanted to compute a means of X weighted
2012 Nov 14
1
Winsorisation function
Dear all, someone can find what I doing wrong with the following function. It is for winsorisation mean. At my eyes it is ok, but for reason I sometimes it is changing the results when I change the k value. wmean <- function (x, na.rm = FALSE, k = 1) { if (any(i.na <- is.na(x))) { if (na.rm) x <- x[!i.na] else return(NA) } n
2006 Jun 19
2
Nested variance-covariance matrix in Multilevel model
Dear R community, I have trouble implementing a nested variance-covariance matrix in the lme function. The model has two fixed effects called End and logpgc, the response variable is the logarithm to base 2 of Intensity ( log2(Intensity) ) and the random effects are called Probe and ProbeNo. The model has the following nesting structure: A Pixel is nested within the ProbeNo,the ProbeNo is
2011 Sep 22
2
suggestions argument in rbga function in genalg package
Would someone be so kind as to provide example code where they use the suggestions argument in the rgba function In genalg? I can't get it to work. The following code works just fine: GenFit <-rbga(Lower, Upper, evalFunc = evaluate) Lower and Upper are each numeric vectors with 7 elements. Evaluate is an objective function. However, when I want to use a suggested chromosome, I get an
2014 Sep 11
2
[LLVMdev] Fail to load a pointer to a function inside MCJIT-ed code when it is reload from ObjectCache
Thank you Lang. I attached the ELF object file here for your reference. Here is the IR dump of JittedOpExpr LLVM function. IrExprGetValue1 LLVM function calls to external function expr->evalfunc(expr, econtext, isNull, isDone); which should be pointed by 0x7fe4801fa1f8. However, only the first time MCJIT generated object point to expr->evalfunc but second time when program load from object
2013 Mar 28
1
make R program faster
Hi there are some good tips in "The R Inferno" http://www.burns-stat.com/documents/books/the-r-inferno/ or connect C++ to R with Rcpp http://dirk.eddelbuettel.com/code/rcpp.html or byte code compiler (library(compiler)) or library(data.table) but do you have an idea to fasten standard R source code, with the following Rprof output self.time self.pct total.time
2014 Sep 11
2
[LLVMdev] Fail to load a pointer to a function inside MCJIT-ed code when it is reload from ObjectCache
Hi, All I have a problem to reuse mcjit jitted code loaded from ObjectCache from a file. In the first run, I use MCJIT generate function JittedOpExpr object code as following and it runs OK. 0x7fe4801fa1f8 at instruction 0x00007fe4cc6c2014 points to 0x69382E which is the beginning of ExecEvalVar function. Then I save the object code into a file after implementing notifyObjectCompiled method.
2005 May 12
2
tempsum
hi, i'd like to calculate a temperatursum, adding the value of each element. let's say the data looks like this: x<-c(1,2,3,4,5) what i want to do, is ploting not the sum in the end but all the subresults, too, so my vector holds: x[i] [1] 1,3,6,10,15 here is what i tried, which seems to be right to me, bu doesn't work out: x<-c(1,2,3,4,5) i<-1 j<-1
2006 Oct 10
2
find weighted group mean
HI, I am trying to figure out an efficient way to calculate group means and associate each entry with it. I made up an example: A = rep(rep(0:1,each=2),3) B = rep(rep(0:1,4),3) C = rep(rep(c(0,0,1,1),2),3) X =cbind(rnorm(24,0,1),runif(24,0,1),A,B,C) A B C [1,] -1.92926469 0.32213127 0 0 0 [2,] -0.83935617 0.77794096 0 1 0 [3,] -1.27799751
2004 Mar 03
7
Location of polr function
Hello I am running R 1.8.1 on a Windows platform I am attempting to fit an ordinal logistic regression model, using the polr function, as described in Venables and Ripley. But when I try model4 <- polr(ypsxcat~committed + as.factor(sex) + as.factor(drugusey) + anycsw + as.factor(sex)*committed + as.factor(sex)*as.factor(drugusey)+as.factor(sex)*anycsw, data = duhray) I get a message
2005 Aug 26
1
Help in Compliling user -defined functions in Rpart
I have been trying to write my own user defined function in Rpart.I imitated the anova splitting rule which is given as an example.In the work I am doing ,I am calculating the concentration index(ci) ,which is in between -1 and +1.So my deviance is given by abs(ci)*(1-abs(ci)).Now when I run rpart incorporating this user defined function i get the following error message: Error in
2007 Feb 19
3
summary polr
Hi all, I have a problem to estimate Std. Error and t-value by ?polr? in library Mass. They result from the summary of a polr object. I can obtain them working in the R environment with the following statements: temp <- polr(formula = formula1, data = data1) coeff <- summary(temp), but when the above statements are enclosed in a function, summary reports the following error:
2012 Jul 09
3
Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'
Hello, I am trying to run an ordinal logistic regression (polr) using the package 'MASS'. I have successfully run other regression classes (glm, multinom) without much problem, but with the 'polr' class I get the following error: " Error in svd(X) : infinite or missing values in 'x' " which appears when I run the "summary" command. The data file is
2010 Nov 03
2
bugs and misfeatures in polr(MASS).... fixed!
In polr.R the (several) functions gmin and fmin contain the code > theta <- beta[pc + 1L:q] > gamm <- c(-100, cumsum(c(theta[1L], exp(theta[-1L]))), 100) That's bad. There's no reason to suppose beta[pc+1L] is larger than -100 or that the cumulative sum is smaller than 100. For practical datasets those assumptions are frequently violated, causing the
2002 Jun 04
2
machine dependency [polr()/optim()]
Dear R experts: I am running some calculations using polr() in MASS library, and found some differences in results obtained on two different machines (IRIX 6.5, and Linux RH 7.1). It is not clear to me whether this is due to some error in my programming the calculation and how to resolve the differences, if possible. The polr() call is the following:
2009 Jan 13
1
deviance in polr method
Dear all, I've replicated the cheese tasting example on p175 of GLM's by McCullagh and Nelder. This is a 4 treatment (rows) by 9 ordinal response (cols) table. Here's my simple code: #### cheese library(MASS) options(contrasts = c("contr.treatment", "contr.poly")) y = c(0,0, 1, 7, 8,8,19, 8,1, 6,9,12,11, 7,6, 1, 0,0, 1,1, 6, 8,23,7,
2002 Feb 07
1
newbie question: polr and glm.control
I'm running polr() and getting warning messages from glm.fit(). It seems reasonable to use glm.control() to turn on the trace and follow what glm.fit() does when called by polr(); or is it? glm.control(maxit=10, trace=TRUE) polr(act~., data=mm) The glm.control() sets the trace TRUE, but there's no change in the output from polr(). Many thanks in advance for any help/pointers.
2008 Jan 05
1
Likelihood ratio test for proportional odds logistic regression
Hi, I want to do a global likelihood ratio test for the proportional odds logistic regression model and am unsure how to go about it. I am using the polr() function in library(MASS). 1. Is the p-value from the likelihood ratio test obtained by anova(fit1,fit2), where fit1 is the polr model with only the intercept and fit2 is the full polr model (refer to example below)? So in the case of the
2011 Mar 01
1
How to understand output from R's polr function (ordered logistic regression)?
I am new to R, ordered logistic regression, and polr. The "Examples" section at the bottom of the help page for polr<http://stat.ethz.ch/R-manual/R-patched/library/MASS/html/polr.html>(that fits a logistic or probit regression model to an ordered factor response) shows options(contrasts = c("contr.treatment", "contr.poly")) house.plr <- polr(Sat ~ Infl +
2010 Sep 06
3
likelyhood maximization problem with polr
Dear community, I am currently trying to fit an ordinal logistic regression model with the polr function. I often get the same error message : "attempt to find suitable starting values failed", for example with : require(MASS) data(iris) polr(Species~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width,iris) (I know the response variable Species should be nominal but I do as levels