similar to: subscript out of bounds error in lda

Displaying 20 results from an estimated 5000 matches similar to: "subscript out of bounds error in lda"

2011 Mar 30
1
Using xlevels
I'm working on predict.survreg and am confused about xlevels. The model.frame method has the argument, but none of the standard methods (model.frame.lm, model.frame.glm) appear to make use of it. The documentation for model.matrix states: xlev: to be used as argument of model.frame if data has no "terms" attribute. But the terms attribute has no xlevels information in it, so I
2011 Dec 26
2
glm predict issue
Hello, I have tried reading the documentation and googling for the answer but reviewing the online matches I end up more confused than before. My problem is apparently simple. I fit a glm model (2^k experiment), and then I would like to predict the response variable (Throughput) for unseen factor levels. When I try to predict I get the following error: > throughput.pred <-
2009 Jul 14
2
SOS! error in GLM logistic regression...
Hi all, Could anybody tell me what happened to my logistic regression in R? mylog=glm(mytraindata$V1 ~ ., data=mytraindata, family=binomial("logit")) It generated the following error message: Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : factor 'state1' has new level(s) AP Thank you!
2005 Aug 15
2
stepAIC invalid scope argument
I am trying to replicate the first example from stepAIC from the MASS package with my own dataset but am running into error. If someone can point where I have gone wrong, I would appreciate it very much. Here is an example : set.seed(1) df <- data.frame( x1=rnorm(1000), x2=rnorm(1000), x3=rnorm(1000) ) df$y <- 0.5*df$x1 + rnorm(1000, mean=8, sd=0.5) # pairs(df); head(df) lo <-
2009 Feb 26
1
using predict method with an offset
Hi, I have run into another problem using offsets, this time with the predict function, where there seems to be a contradiction again between the behavior and the help page. On the man page for predict.lm, it says Offsets specified by offset in the fit by lm will not be included in predictions, whereas those specified by an offset term in the formula will be. While it indicates nothings about
2009 Aug 19
2
Problem with predict.coxph
We occasionally utilize the coxph function in the survival library to fit multinomial logit models. (The breslow method produces the same likelihood function as the multinomial logit). We then utilize the predict function to create summary results for various combinations of covariates. For example:
2008 Oct 05
1
Help on R Coding
Hi all, I am kind of stuck of using Predict function in R to make prediction for a model with continuous variable and categorial variables. i have no problem making the model, the model is e.g. cabbage.lm2<- lm(VitC ~ HeadWt + Date + Cult) HeadWt is a continuous variable, Date and Culte are factors. Date have three levels inside (d16,d20,d21), Cult has two levels(c39,c52). I need to
2011 Mar 23
1
predict.lm How to introduce new data?
Dear all, I've fitted a lm using 61 data (training data), and I'left 10 as test data. Training data and test data are stored in an excell. training <- read.xls("C:/...../training.xls") , the same for test. That is: v1 v2 ... v15 When I type str(training) and str(test), both sets have the same names The resulting model is lms <- lm(vd ~ log(v1) + fv2+ fv5+ fv7 )
2018 Mar 16
2
Apparent bug in behavior of formulas with '-' operator for lm
Dear R-developers, In the 'lm' documentation, the '-' operator is only specified to be used with -1 (to remove the intercept from the model). However, the documentation also refers to the 'formula' help file, which indicates that it is possible to subtract any term. Indeed, the following works with no problems (the period '.' stands for 'all terms except the
2011 Mar 03
1
Error in model.frame.default
Dear R- Community, to learn i reanalysed some data provided and analysed by Zuur et. al. in their book "Mixed effect models and Extensions in Ecology with R". When i run the last command i get a warning message i dont understand. Loyn<- read.table(file = "loyn.txt",header = TRUE) Loyn$L.AREA<- log10(Loyn$AREA) fGRAZE <-factor(Loyn$GRAZE) M0<- lm(ABUND~ L.AREA
2005 Aug 16
1
predict nbinomial glm
Dear R-helpers, let us assume, that I have the following dataset: a <- rnbinom(200, 1, 0.5) b <- (1:200) c <- (30:229) d <- rep(c("q", "r", "s", "t"), rep(50,4)) data_frame <- data.frame(a,b,c,d) In a first step I run a glm.nb (full code is given at the end of this mail) and want to predict my response variable a. In a second step, I would
2003 Sep 16
2
can predict ignore rows with insufficient info
I need predict to ignore rows that contain levels not in the model. Consider a data frame, "const", that has columns for the number of days required to construct a site and the city and state the site was constructed in. g<-lm(days~city,data=const) Some of the sites in const have not yet been completed, and therefore they have days==NA. I want to predict how many days these sites
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
2007 May 01
1
Levels attribute in integer columns created by model.frame()
The following is evidence of what is surely an undesirable feature. The issue is the handling, in calls to model.frame(), of an explanatory variable that has been derived as an unclassed factor. (Ross Darnell drew this to my attention.) ## Data are slightly modified from p.191 of MASS > worms <- data.frame(sex=gl(2,6), Dose=factor(rep(2^(0:5),2)), +
2019 Aug 30
3
inconsistent handling of factor, character, and logical predictors in lm()
Dear R-devel list members, I've discovered an inconsistency in how lm() and similar functions handle logical predictors as opposed to factor or character predictors. An "lm" object for a model that includes factor or character predictors includes the levels of a factor or unique values of a character predictor in the $xlevels component of the object, but not the FALSE/TRUE values
2005 Aug 15
1
error in predict glm (new levels cause problems)
Dear R-helpers, I try to perform glm's with negative binomial distributed data. So I use the MASS library and the commands: model_1 = glm.nb(response ~ y1 + y2 + ...+ yi, data = data.frame) and predict(model_1, newdata = data.frame) So far, I think everything should be ok. But when I want to perform a glm with a subset of the data, I run into an error message as soon as I want to predict
2007 Jul 19
2
Subsetting dataframes
Dear all! W2k, R 2.5.1 I am working with an ongoing malting barley variety evaluation within Sweden. The structure is 25 cultivars tested each year at four sites, in field trials with three replicates and 'lattice' structure (the replicates are divided into five sub blocks in a structured way). As we are normally keeping around 15 varieties from each year to the next, and take in 10 new
2018 Mar 16
2
Apparent bug in behavior of formulas with '-' operator for lm
Joris, the point is that 'z' is NOT used as a predictor in the model. Therefore it should not affect predictions. Also, I find it suspicious that the error only occurs when the response variable conitains missings and 'z' is unique (I have tested several other cases to confirm this). -Mark Op vr 16 mrt. 2018 om 13:03 schreef Joris Meys <jorismeys at gmail.com>: >
2005 Nov 17
1
Predicting and Plotting "hypothetical" values of factors
Last Friday, I noticed that it is difficult to work with regression models in which there are factors. It is easier to do the old fashioned thing of coding up "dummy" variables with 0-1 values. The predict function's newdata argument is not suited to insertion of hypothetical values for the factor, whereas it has no trouble with numeric variables. For example, if one uses a
2012 Sep 08
1
Using predict() After Adding a Factor to a glm.nb() Model
# Hello, # I have a data set that looks something like the following: site<-c(rep('a',5),rep('b',2),rep('c',4),rep('d',11)) year<-c(1980, 1981, 1982, 1993, 1995, 1980, 1983, 1981, 1993, 1995, 1999, c(1980:1990)) count<-c(60,35,36,12,8,112,98,20,13,15,15,65,43,49,51,34,33,33,33,40,11,0) data<-data.frame(site, year, count) # > site year count # 1