similar to: memory and step()

Displaying 20 results from an estimated 20000 matches similar to: "memory and step()"

2010 Mar 09
2
looping through predictors
Dear R-ers, I have a data frame data with predictors x1 through x5 and the response variable y. I am running a simple regression: reg<-lm(y~x1, data=data) I would like to loop through all predictors. Something like: predictors<-c("x1","x2",... "x10) for(i in predictors){ reg<-lm(y~i) etc. } But it's not working. I am getting an error: Error in
2009 Feb 23
2
Formula that includes previous row values
Hi R users, Is there an easy way in R to generate the results table below using table 1 and the formula (simplified version of the real problem)? It would be easy if I knew the R equivalent of SAS's retain function, but could not find one. Thanks in Advance for any help! table1: ID X2 X3 1.00 1.00 0 2.00 0.00 3.00 1.00 4.00 3058 5.00 0.00 6.00 6.00 Formula: X3 = x2 + (.24 *
2001 Nov 05
1
stepwise algorithm step() on coxph() (PR#1159)
Full_Name: Jerome Asselin Version: 1.3.1 OS: MacOS 9.2 Submission from: (NULL) (142.103.173.46) The step() function attempts to calculate the deviance of fitted models even if does not really need it. As a consequence, the step() function gives an error when it is used with coxph(). (There is currently no method to calculate the deviance of coxph() fits.) The code below gives an example of how
2013 Aug 22
1
varpart
Dear R-users I applied vegan's varpart function to partition the effects of explanatory matrices. Adj. R square for the unique fraction [a] is 0.25. Does anyone know why the decomposition by hand using rda gives me a different result for [a] (constrained proportion is 0.32)? I used cbind() for the conditional fractions, but it should be similar to condition()? Thanks very much
2011 Mar 21
3
How to substract a valur from dataframe with condition
Hello All, I need help with my dataframe, it is big but here I am using a small table as an example. My dataframe df looks like: X1 X2 X3 1 2011-02 0.00 96.00 2 2011-02 0.00 2.11 3 2011-02 2.00 3.08 4 2011-02 0.06 2.79 5 2011-02 0.00 96.00 6 2011-02 0.00 97.00 7 2011-02 0.08 2.23 I want values in columns X2 and X3 to be checked if they are greater than
2008 Aug 11
1
help on model selection - step()
dears R-users, I'm interested in model selection problem, and i have faced some problems that i would like to ask for help. well, this is a very small example with 4 variable (just one var. is the response - z) with 100 individuals i would like to do a stepwise search, for the "best" model, and a use BIC criteria. I know when I have a lot of variables, let's say 120, I know,
2010 Apr 01
1
Factorial regression with multiple features: how to remove non-significant features?
Hello all, I am trying to do factorial regression using lm() like this (example): model<-lm(y ~ x1 + x2 + x3 + x4 + x1*x2*x3*x4) The final term 'x1*x2*x3*x4' adds all possible interactions between explanatory variables to the model. i.e. x1:x2, x1:x2:x3, etc, etc. Now, the issue is that some of the interactions are significant and some are not. I can manually remove
2009 Nov 02
1
for parameter 'keep' in 'step'
Hello Lady or Sir, I want to do model selection with 'step' function. But there is a trouble to me. For example, there are 5 independent variables, X0,X1,X2,X3 and X4; and 1 dependent variable y. I want to run stepwise regression y ~ X0 + X1 + X2 + X3 + X4, and I want to keep X0 always in the model. Every time when I run command 'step' with 'keep', error information
2009 Nov 16
2
fitting a logistic regression with mixed type of variables
Hi, I am trying to fit a logistic regression using glm, but my explanatory variables are of mixed type: some are numeric, some are ordinal, some are categorical, say If x1 is numeric, x2 is ordinal, x3 is categorical, is the following formula OK? *model <- glm(y~x1+x2+x3, family=binomial(link="logit"), na.action=na.pass)* * * *Thanks,* * * *-Jack* [[alternative HTML version
2003 Jul 14
1
gam and step
hello, I am looking for a step() function for GAM's. In the book Statistical Computing by Crawley and a removal of predictors has been done "by hand" model <- gam(y ~s(x1) +s(x2) + s(x3)) summary(model) model2 <- gam(y ~s(x2) + s(x3)) # removal of the unsignificant variable #then comparing these two models if an significant increase occurs. anova(model, model2,
2002 Apr 23
1
Tree package on R 1.4.1
Dear R-users I would like to apply classification and regression tree(CART) to the following data. I have some question on using 'tree' package. The data contains one response variable Y and five explanatory variables. The explanatory variable "x2" is categorical and not ordinal. But, the result obtained after running following R code has indicated that x2 is regard as
2010 Oct 03
5
How to iterate through different arguments?
If I have a model line = lm(y~x1) and I want to use a for loop to change the number of explanatory variables, how would I do this? So for example I want to store the model objects in a list. model1 = lm(y~x1) model2 = lm(y~x1+x2) model3 = lm(y~x1+x2+x3) model4 = lm(y~x1+x2+x3+x4) model5 = lm(y~x1+x2+x3+x4+x5)... model10. model_function = function(x){ for(i in 1:x) { } If x =1, then the list
2009 Sep 04
1
User defined function's argument as Subset function's input
Dear R users, I have a data where I desire to subset according to certain conditions. However, the script is very messy as there are about 30 distinct conditions. (i.e. same script but with different conditions) I would like to make a user defined function so that I can input the desired conditions and just get the results accordingly. Below is an arbitrary data set & sample statements
2018 Mar 04
2
lmrob gives NA coefficients
Thanks for your reply. I use mvrnorm from the *MASS* package and lmrob from the *robustbase* package. To further explain my data generating process, the idea is as follows. The explanatory variables are generated my a multivariate normal distribution where the covariance matrix of the variables is defined by Sigma in my code, with ones on the diagonal and rho = 0.15 on the non-diagonal. Then y
2018 Mar 04
0
lmrob gives NA coefficients
What is 'd'? What is 'n'? On Sun, Mar 4, 2018 at 12:14 PM, Christien Kerbert < christienkerbert at gmail.com> wrote: > Thanks for your reply. > > I use mvrnorm from the *MASS* package and lmrob from the *robustbase* > package. > > To further explain my data generating process, the idea is as follows. The > explanatory variables are generated my a
2007 Aug 20
1
Ask for functions to obtain partial R-square (squared partial correlation coefficients)
The partial R-square (or coefficient of partial determination, or squared partial correlation coefficients) measures the marginal contribution of one explanatory variable when all others are already included in multiple linear regression model. The following link has very clear explanations on partial and semi-partial correlation: http://www.psy.jhu.edu/~ashelton/courses/stats315/week2.pdf In
2005 Nov 23
2
vector of permutated products
Given an x-vector with, say, 3 elements, I would like to compute the following vector of permutated products (1-x1)*(1-x2)*(1-x3) (1-x1)*(1-x2)*x3 (1-x1)*x2*(1-x3) x1*(1-x2)*(1-x3) (1-x1)*x2*x3 x1*(1-x2)*x3 x1*x2*(1-x3) x1*x2*x3 Now, I already have the correctly sorted matrix of permutations! So, the input looks something like: #input x<-c(0.3,0.1,0.2) Nx<-length(x) Ncomb<-2^Nx
2018 Mar 03
2
lmrob gives NA coefficients
Dear list members, I want to perform an MM-regression. This seems an easy task using the function lmrob(), however, this function provides me with NA coefficients. My data generating process is as follows: rho <- 0.15 # low interdependency Sigma <- matrix(rho, d, d); diag(Sigma) <- 1 x.clean <- mvrnorm(n, rep(0,d), Sigma) beta <- c(1.0, 2.0, 3.0, 4.0) error <- rnorm(n = n,
2018 Mar 04
1
lmrob gives NA coefficients
d is the number of observed variables (d = 3 in this example). n is the number of observations. 2018-03-04 11:30 GMT+01:00 Eric Berger <ericjberger at gmail.com>: > What is 'd'? What is 'n'? > > > On Sun, Mar 4, 2018 at 12:14 PM, Christien Kerbert < > christienkerbert at gmail.com> wrote: > >> Thanks for your reply. >> >> I use
2005 Jun 09
1
Prediction in Cox Proportional-Hazard Regression
He, I used the "coxph" function, with four covariates. Let's say something like that > model.1 <- coxph(Surv(Time,Event)~X1+X2+X3+X4,data=DATA) So I obtain the 4 coefficients B1,B2,B3,B4 such that h(t) = h0(t) exp(B1*X1+ B2*X2 + B3*X3 + B4*X4). When I use the function on the same data > predict.coxph(model.1,type="lp") how it works in making the prediction?