search for: dataclass

Displaying 20 results from an estimated 55 matches for "dataclass".

2012 Jan 05
1
delete.response leaves response in attribute dataClasses
...bject alters the formula by removing the dependent variable. It removes the response from the "variables" attribute and it changes the response attribute from 1 to 0. The response is removed from "predvars" But it leaves the name of the dependent variable first in the in "dataClasses". It caused an unexpected behavior in my code, so (as usual) the bug may be mine, but in my heart, I believe it belongs to delete.response. To illustrate, here's a terms object from a regression. > tt y ~ x1 * x2 + x3 + x4 attr(,"variables") list(y, x1, x2, x3, x4) attr(,...
2019 Apr 05
1
subscripting a terms object
...eport for survival2.44.1-1 that involves a model with both cluster and offset.? It turns out to be a 3 part issue with [.terms and my own untangle.specials routine.?? I've spent an evening sorting out the details. ? 1. The delete.response() function doesn't remove the response from the dataClasses attribute, which leads to a later failure in [.terms for no-response models.? Is there a reason for this, or can I make my patch include this oversight as well? ?2. [.terms messes up predvars and dataClasses if the model has an offset term in it.? (In select cases 1 and 2 can cancel out and...
2018 Mar 07
3
Names of variables needed in newdata for predict.glm
...factor(sample(letters[1:4],200,rep=T)), Y = runif(200,0.5,10) ) mx <- glm( D ~ ns(x,knots=1:2,Bo=c(0,5)) + f:I(x^2) , offset=log(Y) , family=poisson, data=dd) mi <- glm( D ~ ns(x,knots=1:2,Bo=c(0,5)) + f:I(x^2) + offset(log(Y)), family=poisson, data=dd) attr(mx$terms,"dataClasses") attr(mi$terms,"dataClasses") mi$xlevels mx$xlevels ...so far not quite there. Regards, Bendix Carstensen Senior Statistician Steno Diabetes Center Clinical Epidemiology Niels Steensens Vej 2-4 DK-2820 Gentofte, Denmark b at bxc.dk bendix.carstensen at regionh.dk http://Bendix...
2019 Apr 05
6
all.equal failure
...tandard data set t0x <- terms(model.frame( ~ tobgp, data=esoph)) t1 <-? terms(model.frame(ncases ~ agegp + tobgp, data=esoph)) t1x <- (delete.response(t1))[-1] > all.equal(t0x, t1x) [1] TRUE # the above is wrong, because they actually are not the same > all.equal(attr(t0x, 'dataClasses'), attr(t1x, 'dataClasses')) [1] "Names: 1 string mismatch" [2] "Lengths (1, 2) differ (string compare on first 1)" > sessionInfo() R Under development (unstable) (2019-04-05 r76323) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.2 LTS Mat...
2018 Mar 08
0
Names of variables needed in newdata for predict.glm
...4],200,rep=T)), > Y = runif(200,0.5,10) ) > mx <- glm( D ~ ns(x,knots=1:2,Bo=c(0,5)) + f:I(x^2) , offset=log(Y) , family=poisson, data=dd) > mi <- glm( D ~ ns(x,knots=1:2,Bo=c(0,5)) + f:I(x^2) + offset(log(Y)), family=poisson, data=dd) > > attr(mx$terms,"dataClasses") > attr(mi$terms,"dataClasses") > mi$xlevels > mx$xlevels > > ...so far not quite there. > > Regards, > > Bendix Carstensen > > Senior Statistician > Steno Diabetes Center > Clinical Epidemiology > Niels Steensens Vej 2-4 > DK-2820 Gent...
2011 Apr 19
1
How to Extract Information from SIMEX Output
...er")= int 1 .. .. .. ..- attr(*, "intercept")= int 1 .. .. .. ..- attr(*, "response")= int 1 .. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> .. .. .. ..- attr(*, "predvars")= language list(y, x) .. .. .. ..- attr(*, "dataClasses")= Named chr [1:2] "factor" "numeric" .. .. .. .. ..- attr(*, "names")= chr [1:2] "y" "x" ..$ x : num [1:1615, 1:2] 1 1 1 1 1 1 1 1 1 1 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:1615] "1...
2012 Jan 25
0
Last Call: Who says this is not a bug in delete.response()?
...bject alters the formula by removing the dependent variable. It removes the response from the "variables" attribute and it changes the response attribute from 1 to 0. The response is removed from "predvars" But it leaves the name of the dependent variable first in the in "dataClasses" attribute. I believe delete.response should be fixed, and if I'm wrong, I wish one of you would tell me. Otherwise, I will ask Prof. Ripley to re-open the bug report. This is an important API question, since functions that use regression models (in my opinion) ought to be able to cou...
2002 Jun 28
1
package `methods' has persistent effects even if detached (PR#1715)
This came from an error in reg-tests-1.R > x <- as.data.frame(x=I("C"))[[1]] > class(x) [1] "AsIs" > library(methods) > detach("package:methods") > search() [1] ".GlobalEnv" "package:ctest" "Autoloads" "package:base" > x <- as.data.frame(x=I("C"))[[1]] > class(x) [1] "AsIs"
2018 Mar 31
1
Names of variables needed in newdata for predict.glm
...4],200,rep=T)), > Y = runif(200,0.5,10) ) > mx <- glm( D ~ ns(x,knots=1:2,Bo=c(0,5)) + f:I(x^2) , offset=log(Y) , family=poisson, data=dd) > mi <- glm( D ~ ns(x,knots=1:2,Bo=c(0,5)) + f:I(x^2) + offset(log(Y)), family=poisson, data=dd) > > attr(mx$terms,"dataClasses") > attr(mi$terms,"dataClasses") > mi$xlevels > mx$xlevels > > ...so far not quite there. > > Regards, > > Bendix Carstensen > > Senior Statistician > Steno Diabetes Center > Clinical Epidemiology > Niels Steensens Vej 2-4 > DK-2820 Gent...
2003 Mar 17
1
R-devel on Darwin
...vel on Darwin with two-level namespaces and without using --bundle_loader path/to/R.bin, so that all symbols must come from libR.dylib. This goes well, until during the methods package build all.rda must be made from all.R. Then I get dumping R code in package 'methods' Error: Object "dataClass" not found Execution halted I can get past this point by copying an old all.rda from 1.6.2 to library/methods/R, but not surprisingly (!!) I then get into trouble when trying to start R. Date/Time: 2003-03-16 17:38:30 -0800 OS Version: 10.2.5 (Build 6L11) Host: cabledoc116.frazmtn.com...
2010 Aug 13
2
Unable to retrieve residual sum of squares from nls output
....$ stopCode : int 0 > ..$ stopMessage: chr "converged" > $ data : language parent.frame() > $ call : language nls(formula = NEWY ~ PMESOR + PAMPLITUDE * cos(2 * pi * (NEWX - POFFSET)/PERIOD), start = list(PMESOR = MESOR, PAMPLITUDE = AMPLITUDE, ... > $ dataClasses: Named chr "numeric" > ..- attr(*, "names")= chr "NEWX" > $ control :List of 2 > ..$ maxiter : num 1000 > ..$ warnOnly: logi TRUE > - attr(*, "class")= chr "nls" However, none of these elements appears to contain the res...
2019 Apr 05
0
all.equal failure
...~ tobgp, data=esoph)) > t1 <-? terms(model.frame(ncases ~ agegp + tobgp, data=esoph)) > t1x <- (delete.response(t1))[-1] > > > all.equal(t0x, t1x) > [1] TRUE > > # the above is wrong, because they actually are not the same > > > all.equal(attr(t0x, 'dataClasses'), attr(t1x, 'dataClasses')) > [1] "Names: 1 string mismatch" > [2] "Lengths (1, 2) differ (string compare on first 1)" As documented, all.equal() is generic, with methods for different classes. The classes of both t0x and t1x are c("terms",&q...
2009 Oct 08
0
predict.lm() out-of-sample predictions - problem with data classes
...9 rows Estimating a model from the test-data and examining, the resulting lm-object I found out that the "data classes" switched to "nmatrix.1" - while they were "numeric" for the original model using the traning data. str(ar1.xpred.test.lm$model) ... attr(*, "dataClasses")= Named chr [1:4] "nmatrix.1" "nmatrix.1" "nmatrix.1" "nmatrix.1" ... str(ar1.xpred.lm$model) ... attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" "nmatrix.1" "nmatrix.1" ... I've no...
2003 Nov 11
0
Mismatches in predict(newdata)
...cause model.matrix was trying to handle a 0-level factor (which is what that logical column got converted to by contrasts<-). However, the problem is more general and I have added to R-devel a layer of protection. When model.frame is called, it adds to its terms attribute an attribute "dataClasses", and this can be checked against the newdata argument by a call to .checkMFClasses: see lm and predict.lm for how to do so. Developers who use predict(newdata) may wish to add such code to their packages. (You can use if (!is.null(cl <- attr(Terms, "dataClasses"))...
2019 Apr 05
0
[EXTERNAL] Re: all.equal failure
...~ agegp + tobgp, data=esoph)) >>> t1x <- (delete.response(t1))[-1] >>> >>> ? > all.equal(t0x, t1x) >>> [1] TRUE >>> >>> # the above is wrong, because they actually are not the same >>> >>> ? > all.equal(attr(t0x, 'dataClasses'), attr(t1x, 'dataClasses')) >>> [1] "Names: 1 string mismatch" >>> [2] "Lengths (1, 2) differ (string compare on first 1)" >> >> As documented, all.equal() is generic, with methods for different >> classes.? The classes of both...
2008 Sep 03
1
test if all predictors in a glm object are factors
I'm trying to develop some graphic methods for glm objects, but they only apply for models where all predictors are discrete factors. How can I test for this in a function, given the glm model object? That is, I want something that will serve as an equivalent of is.discrete.glm() in the following context: myplot.glm <- function(model, ...) { if (!inherits(model,"glm"))
2013 May 28
6
Ocultar componentes de una lista
...: int 0 ..$ stopMessage: chr "converged" $ data : symbol data $ call : language nls(formula = Sobs ~ A * Samples/(1 + (B * Samples)), data = data, start = list(A = 5, B = 1), algorithm = "default", control = structure(list(maxiter = 50, tol = 1e-05, ... $ dataClasses: Named chr "numeric" ..- attr(*, "names")= chr "Samples" $ control :List of 5 ..$ maxiter : num 50 ..$ tol : num 1e-05 ..$ minFactor: num 0.000977 ..$ printEval: logi FALSE ..$ warnOnly : logi FALSE - attr(*, "class")= chr "nls&q...
2019 Oct 04
0
Error in [.terms
...first element ? \item The variables and predvars attributes are call objects, each a list() with 4 elments: the response and all 3 predictors ? \item The term.labels attribute omits the resonse and the offset, so has? length 2 ? \item The factors attribute has 4 rows and 2 columns ? \item The dataClasses attribute is a character vector of length 4 \end{itemize} So the ideal result of? mterm[remove the specials] would use subscript of \begin{itemize} ? \item [-5] on the formula itself, variables and predvars attributes ? \item [-2] for term.labels ? \item [-4 , -2, drop=FALSE] for factor attri...
2019 Apr 05
0
[EXTERNAL] Re: Re: all.equal failure
...ete.response(t1))[-1] >>>>> >>>>> ? > all.equal(t0x, t1x) >>>>> [1] TRUE >>>>> >>>>> # the above is wrong, because they actually are not the same >>>>> >>>>> ? > all.equal(attr(t0x, 'dataClasses'), attr(t1x, 'dataClasses')) >>>>> [1] "Names: 1 string mismatch" >>>>> [2] "Lengths (1, 2) differ (string compare on first 1)" >>>> >>>> As documented, all.equal() is generic, with methods for different classes...
2009 Apr 26
1
help with plotting results of lda
...ponse")= int 1 .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> .. ..- attr(*, "predvars")= language list(groups, Comp.1, Comp.2, Comp.3, Comp.4, Comp.5, Comp.6, Comp.7, Comp.8, Comp.9, Comp.10, Comp.11, Comp.12, Comp.13, ... .. ..- attr(*, "dataClasses")= Named chr [1:35] "numeric" "numeric" "numeric" "numeric" ... .. .. ..- attr(*, "names")= chr [1:35] "groups" "Comp.1" "Comp.2" "Comp.3" ... $ call : language lda(formula = groups ~ ., data = e...