similar to: rpart package: why does predict.rpart require values for "unused" predictors?

Displaying 20 results from an estimated 130 matches similar to: "rpart package: why does predict.rpart require values for "unused" predictors?"

2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
Hi R-helpers, My real data is a panel (unbalanced and with gaps in years) of thousands of firms, by year and industry, and with financial information (variables X, Y, Z, for example), the number of firms by year and industry is not always equal, the number of years by industry is not always equal. #reproducible example firm1<-sort(rep(1:10,5),decreasing=F) year1<-rep(2000:2004,10)
2012 Dec 12
2
help with predict.glm, and charting with factors
Dear R Wizards, After much frustration and days of confusion I have finally broken down and am asking for help, which I don’t like doing, but I just can’t figure this one out on my own. I’ve conducted a laboratory experiment testing the effects of temperature and salinity on whether or not a biological event will occur (Go or NoGo). I’ve coded the factors temperature and salinity as factors for
2023 Jan 15
2
Removing variables from data frame with a wile card
I am new to this thread. At the risk of presenting something that has been shown before, below I demonstrate how a column in a data frame can be dropped using a wild card, i.e. a column whose name starts with "th" using nothing more than base r functions and base R syntax. While additions to R such as tidyverse can be very helpful, many things that they do can be accomplished simply
2023 Jan 14
1
Removing variables from data frame with a wile card
Hello Avi, while something like d$something <- ... may seem like you're directly modifying the data it does not actually do so. Most R objects try to be immutable, that is, the object may not change after creation. This guarantees that if you have a binding for same object the object won't change sneakily. There is a data structure that is in fact mutable which are environments. For
2003 Apr 03
4
Two y-axis in plots
Hi, I am trying to plot two data sets on one plot but with using a different y-axis ranges for each - preferably with one shown on each side of the graph. Is there a function that will allow me to do this. Thanks Allan McRae [[alternate HTML version deleted]]
2013 May 21
1
keep the centre fixed in K-means clustering
Dear R users I have the matrix of the centres of some clusters, e.g. 20 clusters each with 100 dimentions, so this matrix contains 20 rows * 100 columns numeric values. I have collected new data (each with 100 numeric values) and would like to keep the above 20 centres fixed/'unmoved' whilst just see how my new data fit in this grouping system, e.g. if the data is close to cluster 1
2012 Sep 24
0
stop on rows where !is.na(mydata$ti_all)
Dear R experts, I got help to build a loop but there is a bug inside it that causes one part of the mechanism to fail. It should grow once, but if keep growing on rows where $ti_all is not NA. Here is a wall of code that very crudely demonstrates the problem, there is a couple of dim() outputs at the end where you can see how it the second time around keeps adds (2) rows, but this does not
2003 Dec 16
0
Help w/ termplot & predict.coxph/ns
I am fitting a cox PH model w/ 2 predictors, x1 = 0/1 treatment variable and x2=continuous variable. I am using natural splines (ns) to model the effect of x2. I would like to examine the estimated effect of x2 on the hazard. I have tried various approaches (below; let model.fit= fitted model using coxph in survival library): 1. The simplest method appears to be using termplot(model.fit).
2011 Sep 27
0
Keep consecutive year observations (remove gap's) in panel data (dataframes). Difficulties in using lag(). Package plm.
Hi everyone. I have two questions. I’ve found some other questions and answers similar to these but they didn’t solve my problem. I’m working with a panel of firm/years observations (see my reproducible example). I’m using the plm package. My panel not only is unbalanced but also have some gap’s in years. #reproducible example
2010 Aug 07
3
plot the dependent variable against one of the predictors with other predictors as constant
Hi, folks, Happy work in weekends >_< My question is how to plot the dependent variable against one of the predictors with other predictors as constant. Not for the original data, but after prediction. It means y is the predicted value of the dependent variables. The constane value of the other predictors may be the average or some fixed value. ####### y=1:10 x=10:1 z=2:11
2010 Aug 06
0
Tukey post hoc test for testing interaction between two or more predictors
Hi everyone, I woudl like to apply a Tukey post hoc after a repeated measure ANOVA. I followed the suggestions that I found in this help -list especially this one: /[R] Tukey HSD (or other post hoc tests) following repeated measures ANOVA You want to use lme() in package nlme, then glht() in the multcomp package. This will give you multiplicity adjusted p-values and confidence intervals.
2012 Dec 01
0
Relative strength of regression predictors (relaimpo vs. relimp)
Hello! I am trying test my observed data against the null-hypothesis that different items from a psychological questionnaire contribute equally to the metric dependent variable that measures problems (sum score of a questionnaire). That is, I am interested in relative strength of the predictors. Predictor items of the questionnaire are on a scale from 0-3, and technically ordinal, although most
2005 Mar 23
0
Error: Can not handle categorical predictors with more th an 32 categories.
It always helps to check whether you got the data into R correctly. Hint: What does str(credit) tell you? Andy > From: Melanie Vida > > Hi All, > > My question is in regards to an error generated when using > randomForest > in R. Is there a special way to format the data in order to > avoid this > error, or am I completely confused on what the error implies?
2007 Jun 14
1
back-transform predictors for x-axis in plot -- mgcv package
My question is related to plot( ) in the mgcv package. Before modelling the data, a few predictors were transformed to normalize them. Therefore, the x-axes in the plots show transformed predictor values. How do I back-transform the predictors so that the plots are easier to interpret? Thanks in advance, Suzan -- Suzan Pool Oregon State University Cooperative Institute for Marine
2006 Feb 21
0
Calculate R-Square for existing predictors
Hello everybody, in the past months I have developed a model to predict the mortality rate of Acute Myocardial Infarction Patients. My evaluation was mainly based on ROC Curves etc. I have now been asked to calculate the R-Square of my model, another existing model in regards to the actual mortality rate. So far I have only found a function calculating a regression, and then the R-Square of the
2018 Mar 02
0
Rstmp2 - linear predictors, AICs and BICs
Dear R-help, I am using R-3.3.2 on Windows 10. As per my previous post today, I teach on a course which has 4 computer practical sessions related to the development and validation of clinical prediction models. These are currently written for Stata and I am in the process of writing them for use in R too (as I far prefer R to Stata!) Part of the practical requires the student to fit a flexible
2003 Sep 01
2
help for performing regressions based on combination of predictors
Dear All, I would like to perform linear regressions based on Y and all of the combinations of the five predictors, i.e.,(y,x1,x2),(y,x1,x3),....,(y,x1,x2,x4,x5),....,(y,x1,x2,x3,x4,x5). Is there any quick way to do it instead of repeat performing regressions for 31 times? Or, is there any method to manipulate the dataset into the 31 combinations? Thanks for your help!
2008 Nov 24
0
correlated predictors in lr
I have Q3 sales for consecutive years 2002-2007 that I'm using to predict buying (yes/no) in Q3 in 2008. My data are arranged in counting process format where each customer has 6 rows of data, one for each year. However, there is no variability within the strata at the customer level: if someone bought in 2008, then all 6 records will be flagged as buy=1. I don't think this will work
2009 Aug 10
0
survival:: plotting survfit with two predictors
Hi R-Helpers, I am having difficulty plotting a coxph model with two predictors. My predictors are "morder" (a factor with five levels where the mean of each level is plotted as a separate line) and tmean (continuous). When I run a model with just morder it is fine and the plot is fine. When I add tmean, the coxph model runs fine but this model will not plot and I receive an
2010 Mar 19
0
lmer: mixed effects models: predictors as random slopes but not found in the fixed effects?
Hello all, I using lmer to develop a mixed effects model. I start with an overly parameterized model (as suggested in Zuur et al. Mixed Effects Models and Extension in Ecology with R) that looks something like this: m1 <- lmer( Y ~ aS + bS + c + d + e + (c|SpeciesId) + (d|SpeciesId) + (e|SpeciesId)) aS and bS are species level predictors an so do not vary within a SpeciesId. However, c, d, and