similar to: poly(x) workaround when x has missing values

Displaying 20 results from an estimated 700 matches similar to: "poly(x) workaround when x has missing values"

2006 Mar 28
2
R crashes during 'eigen'
Hi all, Hi, When I want to compute the eigenvalues & eigenvectors of a specific matrix, R crashes (i.e. it stops responding to any input). I've tried it with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with crashing as result. What I did before the crash was: M <- as.matrix(read.table("thematrix",header=T)) eigen(M) If, instead of eigen(M), I use eigen(M,
2009 Dec 17
1
poly() with unnormalized values
How can I get the result of, e.g., poly(1:3. degree=2) to give me the unnormalized integer coefficients usually used to explain orthogonal polynomial contrasts, e.g, -1 1 0 -2 1 1 As I understand things, the columns of x^{1:degree} are first centered and then are normalized by 1/sqrt(col sum of squares), but I can't see how to relate this to what is returned by poly(). >
2005 Jan 16
1
p.adjust(<NA>s), was "Re: [BioC] limma and p-values"
I append below a suggested update for p.adjust(). 1. A new method "yh" for control of FDR is included which is valid for any dependency structure. Reference is Benjamini, Y., and Yekutieli, D. (2001). The control of the false discovery rate in multiple testing under dependency. Annals of Statistics 29, 1165-1188. 2. I've re-named the "fdr" method to "bh" but
2007 Nov 19
2
delete a row in a matrix
Can anyone tell me how to delete a row in a matrix? I have searched around and couldn't find a straightforward way to do this. Thanks, any help will be greatly appreciated. Jennifer [[alternative HTML version deleted]]
2004 Sep 30
3
Retrieving objects from functions...
I've written a program that involves a loop that creates a matrix. I'd like to be able to manipulate that matrix on my R desktop, but after I run the function, that matrix does not appear when I type ls(). How can I make that matrix become an object that I can manipulate? Thanks!
2003 Oct 27
2
problem using do.call and substitute for predict.glm using poly()
Hi I am having a particular problem with some glm models I am running. I have been adapting code from Bill Venables 'Programmers niche' in RNews Vol 2/2 to fit ca. 1000 glm models to a combination of species 0/1 data (as Y) and related physicochemical data (X), to automate the process of fitting this many models. I have successfully managed to fit all the models and have stored the
2008 Apr 22
1
Bug in poly() (PR#11243)
Full_Name: Russell Lenth Version: 2.6.2 OS: Windows XP Pro Submission from: (NULL) (128.255.132.36) The poly() function allows a higher-degree polynomial than it should, when raw=FALSE. For example, consider 5 distinct 'x' values, each repeated twice. we can fit a polynomial of degree 8: ===== R> x = rep(1:5, 2) R> y = rnorm(10) R> lm(y ~ poly(x, 8)) Call: lm(formula = y ~
2008 Aug 28
2
Defining environments within functions
How can I define environments within a function so that they are visible to calls to a sub-function? I have defined an objective function, ProfileErr = function(params,...) which I would like to optimize using standard routines (optim, nlminb,....) but which contains auxiliary variables which need to be updated along with params. No optimization routine in R that I have found has facilities
2003 Oct 27
3
assign a constant to a different column for each row
Hi all I want to assign a constant to a different column for each row eg: m[1,2] <- 0; m[2,3] <- 0; m[3,1] <- 0; m[4,2] <- 0; m[5,1] <- 0; ... etc... i've tried apply/tapply with no luck and also the following coefs <- rtt.abs[,5:8]; coefs.i <- coefs[] == 1; coefs[coefs.i] <- 0; wich results in "matrix subscripts not allowed in replacement"
2011 Jan 13
1
question about svm(e1071)
Dear all, I executed svm calculation using e1071 library with a microarray data (http://www.iu.a.u-tokyo.ac.jp/~kadota/R/data_Singh_RMA_3274.txt). Then, I shuffled the data samples and executed svm calculation again. The results of 2 calculation were different (in SV, coefs and weights). I attached the script below. Could please tell me why this happens? If possible please tell me how to make
2009 Oct 23
2
interpretation of RCS 'coefs' and 'knots'
Hi, I have fit a series of ols() models, by group, in this manner: l <- ols(y ~ rcs(x, 4)) ... where the series of 'x' values in each group is the same, however knots are not always identical between groups. The result is a table of 'coefs' derived from the ols objects, by group: group Intercept top top' top'' 1 6.864 0.01 2.241 -2.65
2004 Nov 16
1
gcrma package
Hi ! I would like to understand where do affinity.spline.coefs used in function compute.affinities come from ? library(gcrma) data(affinity.spline.coefs) affinity.spline.coefs X1 X2 X3 X4 X5 X1 -0.55004171 -0.58579091 -0.08870557 -0.47774242 0.23205570 0.58002746 X2 X3 X4 X5 X1 X2
2007 Jul 30
2
problems saving and loading (PLMset) objects
Hi I'm running the latest R on a presumably up to date Linux server. 'Doing something silly I'm sure, but can't see why my saved PLMset objects come out all wrong. To use an example: Setting up an example PLMset (I have the same problem no matter what example I use) > library(affyPLM) > data(Dilution) # affybatch object > Dilution = updateObject(Dilution)
2012 Mar 20
2
Constraint Linear regression
Hi there, I am trying to use linear regression to solve the following equation - y <- c(0.2525, 0.3448, 0.2358, 0.3696, 0.2708, 0.1667, 0.2941, 0.2333, 0.1500, 0.3077, 0.3462, 0.1667, 0.2500, 0.3214, 0.1364) x2 <- c(0.368, 0.537, 0.379, 0.472, 0.401, 0.361, 0.644, 0.444, 0.440, 0.676, 0.679, 0.622, 0.450, 0.379, 0.620) x1 <- 1-x2 # equation lmFit <- lm(y ~ x1 + x2) lmFit Call:
2009 Jun 05
1
Bug in print.Arima and patch
Dear List, A posting to R-Help exposed this problem with the print method for objects of class Arima: > set.seed(1) > x <- arima.sim(n = 100, list(ar = 0.8897, ma = -0.2279)) > mod <- arima(x, order = c(1,0,1)) > coefs <- coef(mod) > mod2 <- arima(x, order = c(1,0,1), fixed = coefs) > mod2 Call: arima(x = x, order = c(1, 0, 1), fixed = coefs) Coefficients: Error
2004 Apr 05
1
normalized regression output
Hi: I would like to write a function that takes as its input a formula and outputs normalized coefficients ( coef(x)*sdv(x)/sdv(y) ). now, a formula is an object, and I cannot see how to extract the variables for obtaining sdv's. the intent is to write something like my.print.lm( formula ) { model <- lm(formula); coefs <- (t(summary.lm(model)))[1,]; tvals <-
2017 Jul 13
2
Quadratic function with interaction terms for the PLS fitting model?
Marc: 1. I am aware of the need to explicitly name arguments after ... -- see the R Language definition where this can be inferred from the argument matching rules. 2. I am aware of the stated exception for poly(). However: > x1 <- runif(20) > x2 <- runif(20) > mx <- cbind(x1,x2) > poly(mx,2) Error in poly(dots[[i]], degree, raw = raw, simple = raw) : 'degree'
2006 May 27
1
Recommended package nlme: bug in predict.lme when an independent variable is a polynomial (PR#8905)
Full_Name: Renaud Lancelot Version: Version 2.3.0 (2006-04-24) OS: MS Windows XP Pro SP2 Submission from: (NULL) (82.239.219.108) I think there is a bug in predict.lme, when a polynomial generated by poly() is used as an explanatory variable, and a new data.frame is used for predictions. I guess this is related to * not * using, for predictions, the coefs used in constructing the orthogonal
2007 Apr 05
1
Generate a serie of new vars that correlate with existingvar
Hello, list why not add the smart proposal by Greg Snow as a built-in function in {stats}, just changing the "x234" and "newc" lines to allow for more distributions to be generated ? Or do I miss an already existing function to do that ? Regards. Olivier # slight modification of the original code by Greg Snow [mailto:Greg.Snow at intermountainmail.org] # on April 04, 2007
2009 Aug 09
1
help with a loop (coefficients with lmList)
Hi R-helpers. #I start with the reproducible example: firm<-c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10)) year<-c(rep(1998:2007,5)) industry<-c(rep(1,20),rep(5,10),rep(7,10),rep(9,10)) X1<-rnorm(50) X2<-rnorm(50,mean=0.5,sd=0.1) Y<-rnorm(50,mean=0,sd=0.5) data<-data.frame(firm, industry,year,X1,X2,Y) data #I need to calculate for all the industries the following