similar to: lm(), na.exclude and predict()

Displaying 20 results from an estimated 10000 matches similar to: "lm(), na.exclude and predict()"

2003 Mar 31
4
Convert char vector to numeric table
I'm a great fan of read.table(), but this time the data had a lot of cruft. So I used readLines() and editted the char vector to eventually get something like this: " 23.4 1.5 4.2" " 19.1 2.2 4.1" and so on. To get that into a 3 col numeric table, I first just used: writeLines(data,"tempfile")
2003 May 15
1
Manly's randomization analysis of multiple regression
My wife has been using a diagnostic from Manley (1991; "Randomization and MonteCarlo Methods in Biology") that compares a normal multiple regression's performance with that using random predicted variables. Is there something like this already available in R? If not, the "boot" package looks like a good place to start looking for methods, no? Thanks in advance Bruce
2003 Aug 07
0
predict(lm(etc.), some_data) -> "numeric envir arg not of length one " ???
I've got a data frame with two numeric variables, df$flow and df$flow1. > tl <- lm(flow~flow1,df,na.action=na.exclude) > tlo <- loess(flow~flow1,df,na.action=na.exclude) Both loess and a simple linear model fit the data well. summary(tl) and summary(tlo) seem reasonable. As do plots such as: plot(predict(tl),df$flow) plot(predict(tlo),df$flow) I want to replace missing values
2003 Mar 24
1
using tapply with a matrix?
I've successfully created my own function (topbot) that takes a vector as input and used it with tapply() and an input vector (data$depth) and classification factor (data$profile): vols <- tapply(data$depth, data$profile, topbot) works great. But now I want to do something similar, except my function will take a 3 column matrix with nrows() equal to the factor's length. tapply
2000 Nov 27
1
(NA || x) and (NA && y) {another "bug" } (PR#749)
>>>>> "TL" == Thomas Lumley <thomas@biostat.washington.edu> writes: on Subject: Re: [Rd] Problem with NAs using chisq.test() (PR#748) which I've changed, since it is another bug we are talking about now TL> On Sun, 26 Nov 2000 kjetikj@astro.uio.no wrote: >> Full_Name: Kjetil Kjernsmo .............. .............. TL> However,
2013 Jul 24
1
Understanding modification in place
Hi all, Take this simple script, which I'm trying to use to understand when modification in-place occurs, and when a new object is created: message("Global") x <- 1:3 .Internal(inspect(x)) x[2] <- 1L .Internal(inspect(x)) message("In function") (function() { x <- 1:3 .Internal(inspect(x)) x[2] <- 1L .Internal(inspect(x)) })() If I run it from the
2006 Sep 26
2
Sort problem with merge (again)
# R version 2.3.1 (2006-06-01) Debian Linux "testing" # Is the following behaviour a bug, feature or just a lack of # understanding on my part? I see that this was discussed here # last March with no apparent resolution. d <- as.factor(c("1970-04-04","1970-08-11","1970-10-18")) x <- c(9,10,11) ch <- data.frame(Date=d,X=x) d <-
2019 Jul 17
2
ALTREP wrappers and factors
Hello, I?m experimenting with ALTREP and was wondering if there is a preferred way to create an ALTREP wrapper vector without using .Internal(wrap_meta(?)), which R CMD check doesn?t like since it uses an .Internal() function. I was trying to create a factor that used an ALTREP integer, but attempting to set the class and levels attributes always ended up duplicating and materializing the
2013 Mar 22
1
Why does typeof() modify an object's "named" field?
Hello, Doing typeof() on an object appears to reset the "named" field in its sxpinfo header to 2, which can change the way that subsequent subassignment operations are carried out: X <- 1:5e7 .Internal(inspect(X)) # @4eeb0008 13 INTSXP g0c7 [NAM(1)] (len=50000000, tl=0) 1,2,3,4,5,... system.time(X[1] <- 9L) # user system elapsed # 0 0 0 typeof(X)
2000 Sep 29
1
Two tcltk questions and Re: tcltk package functionality
Sorry, for my mail from last night contains no subject. Therefore, I send it again and two tcltk questions are appended. ---------------------------------------------------------------------------- Prasad wrote: > I wrote a function in R which uses tcltk package .... essentially I wanted > to give within that function, a widget with 2 radiobuttons to choose > between plotting Precip
2006 Aug 30
0
Summary() fails after use of na.action="na.exclude" in lm() (PR#9191)
Hello! I have already reported on this behaviour at [1] and now I have checked the same example on r-devel and the problem is still there. Thomas Lumley inidicated problem [2]. Example: n <- 50 x <- runif(n=n) y1 <- 2 * x + rnorm(n=n) y2 <- 5 * x + rnorm(n=n) y2[sample(1:n, size=5)] <- NA y <- cbind(y1, y2) ## Goes ok here fit <- lm(y1 ~ 1,
2006 Jul 19
1
Bug?: summary() fails after use of na.action="na.exclude" in lm()
Hello! I have encountered a weird problem and I am wondering if this is a bug. Here is the example: n <- 50 x <- runif(n=n) y1 <- 2 * x + rnorm(n=n) y2 <- 5 * x + rnorm(n=n) y2[sample(1:n, size=5)] <- NA y <- cbind(y1, y2) fit <- lm(y1 ~ 1, na.action="na.exclude") summary(fit) ## Goes ok here fit <- lm(y2 ~ 1, na.action="na.exclude") summary(fit)
2013 Jan 24
1
Copy on assignment and .Internal(inspect())
Hi, I would like to know if it's ok to use .Internal(inspect(x)) in order to detect vector copying. Take for example the following silly code: f <- function() { x = seq(10) print(.Internal(inspect(x))) for(i in seq(10)) { x[i] <- x[i] + 1 print(.Internal(inspect(x))) } } The output of f() was: @bd7acf0 13 INTSXP g0c4 [NAM(1)] (len=10, tl=0) 1,2,3,4,5,... [1] 1 2
2019 Jul 12
3
strange increase in the reference number
Hi, I just found a strange increase in the reference number and I'm wondering if there is any reason for it, here is the code. > a=c(1,2,3) > .Internal(inspect(a)) @0x000000001bf0b9b0 14 REALSXP g0c3 [NAM(1)] (len=3, tl=0) 1,2,3 > is.vector(a) [1] TRUE > .Internal(inspect(a)) @0x000000001bf0b9b0 14 REALSXP g0c3 [NAM(7)] (len=3, tl=0) 1,2,3 The variable *a* initially has one
2013 Apr 18
1
find lowest AIC of a LM
hello all, I have a simple linear model with 4/5 variables that I am trying to fit. I would like to find the lowest AIC value with any combination of all the variables. I would like to implement this with a while/for loop. Possibly I would like to generalize this so then I can use it when I have many more variables. I do not want to use step AIC. At the moment I am doing it manually but I
2002 Dec 19
0
Ongoing unhappiness with NA and factor behavior of distributed lm/predict.lm
Hi all, I''m still not quite happy with the NA and factor handling of lm and predict.lm in R1.6.1 (forcing me to use my not very skillfully crafted patches). Here is the problem 1: >
2013 Aug 02
1
[LLVMdev] replacing GetElementPtrConstantExpr with GetElementPtrInst ... sometimes
Hi During a pass, the XCore target lowers thread local global variables by turning them into global variable arrays indexed by the (max 8) thread ID. (see XCoreLowerThreadLocal.cpp) This works fine for instructions e.g. GetElementPtrInst But can't be done for constants e.g. GetElementPtrConstantExpr Thus I would like to replace GetElementPtrConstantExpr with GetElementPtrInst when it is
2009 Mar 17
1
- help - predicting with glmnet/lars for dataframes with different nrow then the train set
Hello I'm having trouble using lars and glmnet functions to predict on a new data set with different nrow then the original : for instance: ============= log.1 = glm(temp.data$TL~(.),temp.data,family = binomial,x=TRUE,y=TRUE) nrow(test.data) != nrow(temp.data # == TRUE Val.frame = model.frame(log.1,test.data) # returns a data frame with the variables needed to use log.1
2008 Sep 22
2
paste with list
Hello, I guess the solution is rather simple but whatever I tried, I don't manage to get the result as I want to have it: I have several vectors of equal length in a list and I'd like to combine all first elements to a single string, all second elements to a single string, ..., all n-th elements to a single string. # Example code (how it should look like): t1 <- c(1,2,3) t2 <-
2001 Jul 04
3
by/ NA/ barplot
Colleagues ---------------------------------- System info: Version 1.3.0 (2001-06-22) on NT ESS v. 5.1.18 using emacs ver. 20.4 ---------------------------------- I have generated an object (class = by) with NA values and want to plot the output as a bargraph: x2 <- by(scl.nos, species, sum) These data are summed counts of fish by species > x2 INDICES: AGI [1] 0.729927