similar to: Other ways to lm() regression? (non-loop?)

Displaying 20 results from an estimated 30000 matches similar to: "Other ways to lm() regression? (non-loop?)"

2012 Jan 01
3
rep() inside of lm()?
HI all, I'm new to R. Say I have a multi-layered list called newlist. ############ > str(newlist) List of 2 $ :List of 5 ..$ : num [1:8088] NA 464 482 535 557 ... ..$ : num [1:8088, 1:2] NA 464 482 535 557 ... ..$ : num [1:8088, 1:3] NA 464 482 535 557 ... ..$ : num [1:8088, 1:4] NA 464 482 535 557 ... ..$ : num [1:8088, 1:5] NA 464 482 535 557 ... $ :List of 3 ..$ : num
2004 Jun 07
2
AGI + g729A
Hello.... I have the follow situatuion: < ISDN > | | V E100P |----------------| IAX2 / g729A |----------------| T100P | Asterisk1 |- - - - - - - - - - - - - - > | Asterisk2 | - - - - - -> |--------------| | | | | | Zhone | ----------------- ----------------- --------------- Here's the situation: I receive calls from the PSTN
2011 Dec 31
2
Very strange function() behaviour.
Hi, R newb here. I've coded a function that inputs N dimensional array(s) [or class=numeric if it's dim=1] of coefficients and tstats, where dim(coef_matrix)=dim(tstat_matrix), it will then output a same dimension matrix of coefficients pasted to tstats in brackets pasted to significance stars. If I go straight to the code INSIDE the function, it works 100% as it's supposed to. The
2012 Mar 24
3
Handling 8GB .txt file in R?
Hi, I am mediocre at R, maybe 1000 hours experience, but I received an 8GB dataset and I don't know what to do with it. I have to do extensive analysis over it for my Honours thesis. I can't even import it. I've tried; - Splitting it up using the free csv-splitter-1.1.zip that seems to be working for everyone else (it doesn't work for me, it just outputs 1 single line). -
2006 Jul 13
1
Question for LM intercept
Hello, I am having the following silly problem with lm. Let X be a dataframe with X[,1] the dependent variable and X[,-1] the independent variables. I want to run the following but without including an intercept. for(i in 1:100 ){ lm( X[,100-i] ) # this works fine but it returns an intercept } Can anyone help me? Thank you in advance! Regards, Themis
2004 Apr 24
4
Moving window regressions - how can I improve this code?
I wrote a function which does "moving window" regressions. E.g. if there are 100 observations and the window width is 50, then I first run the regression for observations 1..50, then for 2..51, and so on. I am extremely pleased with R in my experience with writing this, since I was able to pass the model as an argument into the function :-) Forgive me if I sound naive, but that's
2017 May 04
2
lm() gives different results to lm.ridge() and SPSS
Hi Simon, Yes, if I uses coefficients() I get the same results for lm() and lm.ridge(). So that's consistent, at least. Interestingly, the "wrong" number I get from lm.ridge()$coef agrees with the value from SPSS to 5dp, which is an interesting coincidence if these numbers have no particular external meaning in lm.ridge(). Kind regards, Nick ----- Original Message -----
2011 Aug 03
1
Coefficient names when using lm() with contrasts
Dear R Users, Am using lm() with contrasts as below. If I skip the contrasts() statement, I get the coefficient names to be > names(results$coef) [1] "(Intercept)" "VarAcat" "VarArat" "VarB" which are much more meaningful than ones based on integers. Can anyone tell me how to get R to keep the coefficient names based on the factor levels
2002 Oct 09
5
polynomial
Any better (more efficient, built-in) ideas for computing coef[1]+coef[2]*x+coef[3]*x^2+ ... than polynom <- function(coef,x) { n <- length(coef) sum(coef*apply(matrix(c(rep(x,n),seq(0,n-1)),ncol=2),1,function(z)z[1]^z[2])) } ? Ben -- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker
2017 May 04
4
lm() gives different results to lm.ridge() and SPSS
Hallo, I hope I am posting to the right place. I was advised to try this list by Ben Bolker (https://twitter.com/bolkerb/status/859909918446497795). I also posted this question to StackOverflow (http://stackoverflow.com/questions/43771269/lm-gives-different-results-from-lm-ridgelambda-0). I am a relative newcomer to R, but I wrote my first program in 1975 and have been paid to program in about
2007 Sep 19
3
Row-by-row regression on matrix
Folks, I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a 4-vector (x) to create a matrix lm.y of intercepts and slopes. To illustrate: y <- matrix(rnorm(12000), ncol = 4) x <- c(1/12, 3/12, 6/12, 1) system.time(lm.y <- t(apply(y, 1, function(z) lm(z ~ x)$coefficient))) [1] 44.72 18.00 69.52 NA NA Takes more than a minute to do (and I need to do many
1997 Apr 30
1
R-beta: ls.print
ls.print produces error that I don't seem to be able to trace. Output of the commands as follows: (hyeung is a 24x2 matrix of data) ------------------------------------------------- > summary(hyeung) x.1 x.2 Min. : 28.0 Min. : 10.0 1st Qu.: 72.0 1st Qu.: 87.5 Median : 86.5 Median : 92.5 Mean : 81.0 Mean : 82.5 3rd Qu.: 97.0 3rd Qu.:100.0 Max.
1997 Apr 30
1
R-beta: ls.print
ls.print produces error that I don't seem to be able to trace. Output of the commands as follows: (hyeung is a 24x2 matrix of data) ------------------------------------------------- > summary(hyeung) x.1 x.2 Min. : 28.0 Min. : 10.0 1st Qu.: 72.0 1st Qu.: 87.5 Median : 86.5 Median : 92.5 Mean : 81.0 Mean : 82.5 3rd Qu.: 97.0 3rd Qu.:100.0 Max.
2011 Jul 29
4
finding a faster way to run lm on rows of predictor matrix
Hi, everyone. I need to run lm with the same response vector but with varying predictor vectors. (i.e. 1 response vector on each individual 6,000 predictor vectors) After looking through the R archive, I found roughly 3 methods that has been suggested. Unfortunately, I need to run this task multiple times(~ 5,000 times) and would like to find a faster way than the existing methods. All three
2005 Mar 14
1
calling objects in a foreloop
I want to organize outputs from several regressions into a handy table. When I try the following, each of my "fit_s" is replaces instead of read. Is there a way to read from the regression summaries that does not require writing separate lines of code for each? -Ben Osborne > fit1<-lm(dBA.spp16$sp2.dBA.ha~dBA.spp16$sp1.dBA.ha) >
2006 Aug 20
2
how to the p-values or t-values from the lm's results
Dear friends, After running the lm() model, we can get summary resluts like the following: Coefficients: Estimate Std. Error t value Pr(>|t|) x1 0.11562 0.10994 1.052 0.2957 x2 -0.13879 0.09674 -1.435 0.1548 x3 0.01051 0.09862 0.107 0.9153 x4 0.14183 0.08471 1.674 0.0975 . x5 0.18995 0.10482 1.812 0.0732 . x6 0.24832 0.10059 2.469 0.0154 * x7
2007 Jul 25
2
using contrasts on matrix regressions (using gmodels, perhaps)
Hi, I want to test for a contrast from a regression where I am regressing the columns of a matrix. In short, the following. X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) lm(Y~X) Call: lm(formula = Y ~ X) Coefficients: [,1] [,2] [,3] [,4] [,5] (Intercept) 0.3350 -0.1989 -0.1932 0.7528 0.0727 X1 0.2007 -0.8505 0.0520
2007 Dec 17
2
Capture warning messages from coxph()
Hi, I want to fit multiple cox models using the coxph() function. To do this, I use a for-loop and save the relevant results in a separate matrix. In the example below, only two models are fitted (my actual matrix has many more columns), one gives a warning message, while the other does not. Right now, I see all the warning message(s) after the for-loop is completed but have no idea which model
2001 Aug 01
3
partial correlations
Howdy! I need to calculate partial correlations and I just can't find out how to do that with R. Can anybody help? Ragnar -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !)
2012 Jun 08
1
Saving estimates after nested loops
 Hi R-listers, Savings regression results after a loop is straightforward. But what about when you have nested loops? I am running a regression of the form  lm(y~1+x+M+ D[,i] + D[,j] + D[,k]) where x is the variable of interest. M and D are vectors with other covariates. Vectors "M" and "x" are included in every regression. Then i loop over the columns of D to use all