similar to: Problem storing lm() model in a list

Displaying 20 results from an estimated 600 matches similar to: "Problem storing lm() model in a list"

2008 May 23
1
Shared Library Error
Can anyone help me resolve this? A part of the R function looks like this: print(is.loaded('merge_xtabs_patterns_file')) print(is.loaded('merge_xtabs_patterns_file_')) .Fortran('merge_xtabs_patterns_file_',ydim[1],ydim[2],x=as.integer(as.matrix(y)),na=as.integer(c), maxD=as.integer(maxD),lrowmem=length(rowmem),rowmem=as.integer(rowmem),
2010 Nov 22
1
Plotting a cloud/fog of variable density in rgl
Hi everyone, I want to plot a 3D interpolation of the concentration of aquatic organisms. My goal would be to have the result represented as clouds with a density proportional to the abundance of organisms, so that I could fly (well, swim actually ;) ) through the scene and see the patches here and there. Basically, I want to do something like this: http://www.youtube.com/watch?v=27mo_Y-aU-c but
2011 Nov 09
3
Help with tryCatch with a for loop
Hello all, I'm a beginner in R working on a script that will produce a set of models (linear, polynomial and logistic) for each location in a dataset. However, the self-starting logistic model often fails - if this happens I would like to just skip to the next iteration of the loop using tryCatch. I've looked at a few examples and read the help file, but didn't understand tryCatch
2013 Apr 24
0
Help me make faster R code for Kennard-Stone algorithm [My code is so slow from Matlab]
Hi all, Can you help me change my Kennard-Stone algorithm to faster one? [The original code can run fast in matlab, but when I change matlab code to R code, it is so slow.] Since my code so crude and too many loops (changed from matlab code), it is too slow. I hope that you can help to improve the performance. Thanks. kevin
2010 Jan 18
2
Predict polynomial problem
I have a function that fits polynomial models for the orders in n: lmn <- function(d,n){ models=list() for(i in n){ models[[i]]=lm(y~poly(x,i),data=d) } return(models) } My data is: > d=data.frame(x=1:10,y=runif(10)) So first just do it for a cubic: > mmn = lmn(d,3) > predict(mmn[[3]]) 1 2 3 4 5 6 7 8
2004 Oct 20
2
Odd behaviour with scale()
Moi! A student here has been getting a bit irritated with some side effects of scale() (OS is Windows XP, the behaviour occurs in R 2.0.0, but not 1.7.1). The problem is that she scales a variable in a data frame, then does a regression, and tries to get some predictions for some new data. However, at this point she gets an error (see the example below). This seems to be because the
2005 Jun 02
4
repeated vector in matrix
Hallo, I'll need a matrix with n rows of the an identical vector. > h [1] 3 3 3 3 2 2 2 The nmatrix should look like this: > x<-rbind(h,h,h) > x [,1] [,2] [,3] [,4] [,5] [,6] [,7] h 3 3 3 3 2 2 2 h 3 3 3 3 2 2 2 h 3 3 3 3 2 2 2 but I need n rows which must be variable. Can anyone help me? thanks Andreas
2008 Feb 26
1
predict.rpart question
Dear All, I have a question regarding predict.rpart. I use rpart to build classification and regression trees and I deal with data with relatively large number of input variables (predictors). For example, I build an rpart model like this rpartModel <- rpart(Y ~ X, method="class", minsplit =1, minbucket=nMinBucket,cp=nCp); and get predictors used in building the model like
2012 Mar 06
1
PLS Error message
Hi, I work with hyperspectral remote sensing data and I try to built a pls model with this data. I already built the model but if I try to calculate the RMSEP and R2 with a test data set I get the following error message: Error: variable 'subX' was fitted with type "nmatrix.501" but type "nmatrix.73" was supplied The problem is that I don't get the message for
2002 Oct 04
2
spline bug ?
# Is this a bug or something I don't understand? spline(date, stor, n=52, xmin=mind, xmax=maxd) # gives length(x) of 53 ????, but y has the expected length of 52 # Shouldn't they be the same length? From help (spline): # spline returns a list containing components x and y which give the # ordinates where interpolation took place and the interpolated values # xmin and xmax are inside
2011 Mar 31
1
Effects - plot the marginal effect
Hello, I try to plot the marginal effect by using package "effects" (example of the graph i want to get is in the attached picture). All variables are continuous. Here is regression function, results and error effect function gives: > mreg01 = lm(a90$enep1 ~ a90$enpres + a90$proximity1 + (a90$enpres * a90$proximity1), data=a90)> summary(mreg01) Call: lm(formula = a90$enep1 ~
2004 Apr 04
1
How to improve this code?
Hi all, I've got some functioning code that I've literally taken hours to write. My 'R' coding is getting better...it used to take days :) I know I've done a poor job of optimizing the code. In addition, I'm missing an important step and don't know where to put it. So, three questions: 1) I'd like the resulting output to be sorted on distance (ascending) and
2006 Sep 01
1
difference between ns and bs in predict.glm
I am fittling a spline to a variable in a regression model, I am then using the predict.glm funtion to make some predictions. When I use bs to fit the spline I don't have any problems using the predict.glm function however when I use ns I get the following error: Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : variable lengths differ (found for
2008 Aug 13
3
issue building dataframes with matrices.
Hello, Is this a bug or a feature? I am using R 2.7.1 on Apple OS X. > y <- matrix(1:3,nrow=3) # y is a single-column matrix > df <-data.frame(x=1:3,y=y) > sapply(df,data.class) x y "numeric" "numeric" > df$yy <- y > sapply(df,data.class) x y yy "numeric" "numeric" "matrix"
2011 Apr 19
1
How to Extract Information from SIMEX Output
Below is a SIMEX object that was generated with the "simex" function from the "simex" package applied to a logistic regression fit. From this mountain of information I would like to extract all of the values summarized in this line: .. ..$ variance.jackknife: num [1:5, 1:4] 1.684 1.144 0.85 0.624 0.519 ... Can someone suggest how to go about doing this? I can extract the
2006 Nov 02
3
Better y-axis labels, and x-axis scaling
Hello I'm plotting some data using matplot with a logarithmic scale on the y-axis. This is the call to matplot I'm using: matplot(turns, distances, type = "l", log = "y", lty = "solid", ylab = "", xlab = "Time steps", col = c("black")) The values for the 'distances' vector are always between 0 and 1. The
2009 Jul 20
3
Write in file matrices of sifferent size
Hi list, How to save a list content into a text file? Please consider example below, I have two numeric matrices that I bundle into a list & give each list element a name Example: > matrixA <- matrix(0,5,4) > matrixB <- matrix(1,7,13) > matrixList <- list(matrixA,matrixB) > names <- c("Matrix A","Matrix B") > names <-
2009 Jan 20
1
Creating a Sparse Matrix from a Sparse Vector
Hello, I am working with a sparse matrix that is approx. 13,900 by 14,100. My goal is to select a row out of the matrix and create a new matrix with that row repeated 13,900 times without having to do any looping. Example: Starting Matrix: exampleMatrix 3 x 4 sparse Matrix of class "dgCMatrix" [1,] 1 . . . [2,] . 1 . 0.5 [3,] . . 1 .. New Matrix:.. newExampleMatrix 3 x 4 sparse
2011 Apr 08
1
Variance of random effects: survreg()
I have the following questions about the variance of the random effects in the survreg() function in the survival package: 1) How can I extract the variance of the random effects after fitting a model? For example: set.seed(1007) x <- runif(100) m <- rnorm(10, mean = 1, sd =2) mu <- rep(m, rep(10,10)) test1 <- data.frame(Time = qsurvreg(x, mean = mu, scale= 0.5, distribution =
2009 Oct 08
0
predict.lm() out-of-sample predictions - problem with data classes
Hello! I'm still working on my problem, which also occurs with the predict.lm() function. - Providing newdata, which is a data.frame with all variables being "numeric", as str() shows, R tells me the following: ar1.xpred.test.pred <- predict(ar1.xpred.fitted, regdata.test, se.fit = FALSE) Fehler: variable 'lag(ret1)' was fitted with type "numeric" but type