Displaying 20 results from an estimated 2000 matches similar to: "regressing each column of a matrix on all other columns"
2005 Jun 07
6
transform large matrix into list
Dear List
I need to transform a large matrix M with many NAs into a list L with
one row for each non missing cell. Every row should contain the cell
value in the first column, and its coordinates of the matrix in column
2 and 3.
M:
x1 x2
y1 1 2
y2 4 5
y3 7 8
L:
v x y
1 1 1
4 1 2
7 1 2
2 2 1
5 2 2
8 2 3
I'm trying to do this with a loop, but since my matrix is quite large
(around
2005 Jun 02
3
merge large matrices
Dear List
I have two large matrices A and B. Both have the same dimensions, let's
say 20k x 30k. About half the cells of B are missing. Now I'm looking
for an efficient way to merge them, so that the missing values in B are
replaced by the corresponding values of A.
Matrix A
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
merged with Matrix B
[,1] [,2] [,3]
[1,] 10 NA NA
[2,] NA 50 60
2004 Mar 08
2
getting the std errors in the lm function
Hello,
I have a simple question for you:
making:
mylm<-lm(y~x)
summary(mylm)
I get the following results:
******************************************************
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 16.54087 0.19952 82.91 <2e-16 ***
x[1:19] -2.32337 0.04251 -54.66 <2e-16 ***
******************************************************
2010 Sep 14
1
NA confusion (length question)
Hi folks,
I am running a very simple regression using
mylm <- lm(mass ~ tarsus, na.action=na.exclude)
I would like the use the residuals from this analysis for more
regression but I'm running into a snag when I try
cbind(mylm$residuals, mydata) # where my data is the original data set
The error tells me that it cannot use cbind because the length of
mylm$residuals is
2003 Oct 11
1
Subclassing lm
I'd trying to subclass the "lm" class to produce a "mylm" class whose
instances behave like lm objects (are accepted by methods like summary.lm)
but have additional data or slots of my own design.
For starters:
setClass("mylm", "lm")
produces the somewhat cryptic:
Warning message:
Old-style (``S3'') class "mylm" supplied as a
2009 Mar 31
1
using "substitute" inside a legend
Hello list,
I have a linear regression:
mylm = lm(y~x-1)
I've been reading old mail postings as well as the plotmath demo and I came
up with a way to print an equation resulting from a linear regression:
model = substitute(list("y"==slope%*%"x", R^2==rsq),
list(slope=round(mylm$coefficients[[1]],2),rsq=round(summary(mylm)$adj.r.squared,
2)))
I have four models and I
2009 May 14
1
automated polynomial regression
Dear all -
We perform some measurements with a machine that needs to be
recalibrated. The best calibration we get with polynomial regression.
The data might look like follows:
> true_y <- c(1:50)*.8
> # the real values
> m_y <- c((1:21)*1.1, 21.1, 22.2, 23.3 ,c(25:50)*.9)/0.3-5.2
> # the measured data
> x <- c(1:50)
> # and the x-axes
>
> # Now I do the following:
2011 May 20
2
extraction of mean square value from ANOVA
Hello,
I am randomly generating values and then using an ANOVA table to find the
mean square value. I would like to form a loop that extracts the mean square
value from ANOVA in each iteration. Below is an example of what I am doing.
a<-rnorm(10)
b<-factor(c(1,1,2,2,3,3,4,4,5,5))
c<-factor(c(1,2,1,2,1,2,1,2,1,2))
mylm<-lm(a~b+c)
anova(mylm)
Since I would like to use a loop to
2009 Jan 24
2
how to prevent duplications of data within a loop
Hi All,
I had posted a question on a similar topic, but I think it was not
focused. I am posting a modification that I think better accomplishes
this.
I hope this is ok, and I apologize if it is not. :)
I am looping through variables and running several regressions. I have
reason to believe that the data is being duplicated because I have
been
monitoring the memory use on unix.
How can I avoid
2007 Apr 06
2
lm() intercept at the end, rather than at the beginning
Hi,
I wonder if someone has already figured out a way of making
summary(mylm) # where mylm is an object of the class lm()
to print the "(Intercept)" at the last line, rather than the first
line of the output. I don't know about, say, biostatistics, but in
economics the intercept is usually the least interesting of the
parameters of a regression model. That's why, say, Stata
2007 Oct 30
1
Some matrix and sandwich questions
Dear R-help,
I have a four-part question about regression, matrices, and sandwich package.
1) In the sandwich package, I would like to better understand the
meat() function.
>From the bread() documentation, for a simple OLS regression, bread() returns
(1/n * X'X)^(-1)
That is, for a simple regression (per the documentation on bread()):
MyLM <- lm(y ~ x)
bread(MyLM)
2007 Aug 16
4
Linear models over large datasets
I'd like to fit linear models on very large datasets. My data frames
are about 2000000 rows x 200 columns of doubles and I am using an 64
bit build of R. I've googled about this extensively and went over the
"R Data Import/Export" guide. My primary issue is although my data
represented in ascii form is 4Gb in size (therefore much smaller
considered in binary), R consumes about
2002 Jul 01
1
a little statistics help
Dear R-guRus:
I am stuck with the following problem in R:
Let's say i have a data.frame with columns X,Y & Z.
X is a column of numbers, Y is a column of N
factors "A", "B", "C", "D", etc and Z is a column of n
factors "a", "b", "c", etc
if i do MyLm<-lm(X~Y*Z - 1) i get all N coefficients for Y-factors, but
only
2004 Jul 30
1
Three-way ANOVA?
Hi,
I'm a biologist, so please forgive me if my question sounds absurd! I have 3
parameters x1, x2, x3 and a response variable y.The sample size is 75. I tried
to do the following:
mylm<-lm(y~ x1 + x2 + x3, data="mydata")
but i can only get stats from anova for the first 2 variables. The third comes
up as NA. The degrees of freedom for the third variable are 0.
Is there
2006 Jan 16
4
Standardized beta-coefficients in regression
Hello list,
I am used to give a lot of attention to the standardized regression
coefficients, which in SPSS are listed automatically.
Is there alternative to running the last two lines in the following example to
get all the information?
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
summary( lm(ctl ~ trt) )
2012 Sep 06
0
lme( y ~ ns(x, df=splineDF)) error
I would like to fit regression models of the form
y ~ ns(x, df=splineDF)
where splineDF is passed as an argument to a wrapper function.
This works fine if the regression function is lm(). But with lme(),
I get two different errors, depending on how I handle splineDF
inside the wrapper function.
A workaround is to turn the lme() command, along with the appropriate
value of splineDF, into a text
2012 Sep 26
0
lme(y ~ ns(x, df=splineDF)) error
I would like to fit regression models of the form
y ~ ns(x, df=splineDF)
where splineDF is passed as an argument to a wrapper function.
This works fine if the regression function is lm(). But with lme(),
I get two different errors, depending on how I handle splineDF
inside the wrapper function.
A workaround is to turn the lme() command, along with the appropriate
value of splineDF, into a text
2008 May 05
3
troubles with R CMD check and examples under Ubuntu gutsy
Dear listers,
I was used to package pgirmess under Windows with everything OK, but,
for the first time, I had a trial this afternoon on Ubuntu 7.10 gutsy (I
have a double boot computer and work more and more under unix) and R
2.7.0. Everything went OK except this:
sudo R CMD check pgirmess
.....
* checking examples ... ERROR
Running examples in 'pgirmess-Ex.R' failed.
The error most
2005 Oct 11
2
error message when accessing voicemail
If anyone could tell me what this error is all about, I would be very
grateful.
Oct 12 01:42:53 WARNING[2724]: app.c:1109 ast_lock_path: Failed to lock
path '/var/spool/asterisk/voicemail/default/5933/INBOX': Operation not
permitted
Oct 12 01:42:53 WARNING[2724]: app.c:1109 ast_lock_path: Failed to lock
path '/var/spool/asterisk/voicemail/default/5933/Old': Operation not
2004 Mar 02
2
Some timings for 64 bit Opteron (ATLAS, GOTO, std)
Hi Martin,
When I attended the LinuxWorld Expo in NYC back in January, I chatted with
some folks at the AMD booth, as well as guys from Penguin Computing (where
we bought our Opteron box). I was told that the Operton has this somewhat
strange setup that the memory is controlled by one CPU. The net effect of
this being that when both CPUs are running, one might only be running at
around 90%