Displaying 20 results from an estimated 10000 matches similar to: "optimizing lm with multiple very similar RHSs"
2005 Oct 05
0
Ad: Re: R crashes for large formulas in lm() (PR#8180)
On Wed, 5 Oct 2005 Hallgeir.Grinde at elkem.no wrote:
> And some more informastion I forgot.
> R does not crash if I write out the formula:
>
> set.seed(123)
> x1 <- runif(1000)
> x2 <- runif(1000)
> x3 <- runif(1000)
> x4 <- runif(1000)
> x5 <- runif(1000)
> x6 <- runif(1000)
> x7 <- runif(1000)
> x8 <- runif(1000)
> y <-
2005 Oct 05
0
Ad: Re: Ad: Re: R crashes for large formulas in lm() (PR#8181)
On Wed, 5 Oct 2005 Hallgeir.Grinde at elkem.no wrote:
> Yes.
> so (x1*x2*x3*x4*x5*x6*x7*x8)^2 = (x1+x2+x3+x4+x5+x6+x7+x8)^8 ?
Yes in the sense that the simplified formula given by terms() is the same.
> and there is a difference in
> (x1*x2*x3*x4*x5*x6*x7*x8)^2
> and
> (x1*x2*x3*x4*x5*x6*x7*x8)
> althoug the resulting formulas are the same, or?
The first is reduced to the
2005 Oct 05
0
Ad: Re: Ad: Re: R crashes for large formulas in lm() (PR#8180)
Dette er en melding med flere deler i MIME-format.
--=_alternative 004C4E4A00257091_=
Content-Type: text/plain; charset="US-ASCII"
Yes.
so (x1*x2*x3*x4*x5*x6*x7*x8)^2 = (x1+x2+x3+x4+x5+x6+x7+x8)^8 ?
and there is a difference in
(x1*x2*x3*x4*x5*x6*x7*x8)^2
and
(x1*x2*x3*x4*x5*x6*x7*x8)
althoug the resulting formulas are the same, or?
This fikses my problem, but R still crashes for the
2005 Oct 05
1
Ad: Re: R crashes for large formulas in lm() (PR#8180)
Dette er en melding med flere deler i MIME-format.
--=_alternative 004613C000257091_=
Content-Type: text/plain; charset="US-ASCII"
And some more informastion I forgot.
R does not crash if I write out the formula:
set.seed(123)
x1 <- runif(1000)
x2 <- runif(1000)
x3 <- runif(1000)
x4 <- runif(1000)
x5 <- runif(1000)
x6 <- runif(1000)
x7 <- runif(1000)
x8 <-
2005 Oct 05
0
Ad: Re: R crashes for large formulas in lm() (PR#8180)
> From: Peter Dalgaard
>
> Hallgeir.Grinde at elkem.no writes:
>
> > Dette er en melding med flere deler i MIME-format.
> > --=_alternative 004613C000257091_=
> > Content-Type: text/plain; charset="US-ASCII"
> >
> > And some more informastion I forgot.
> > R does not crash if I write out the formula:
> >
> > set.seed(123)
2007 May 21
0
Is this a bug in cv.lm(DAAG) ?
Dear R-list,
I'm not sure what I've found about a function in DAAG package is a bug.
When I was using cv.lm(DAAG) , I found there might be something wrong with
it. The problem is that we can't use it to deal with a linear model with
more than one predictor variable. But the usage documentation
hasn't informed us about this.
The code illustrates my discovery:
> library(DAAG)
2008 Mar 29
1
Tabulating Sparse Contingency Table
I have a sparse contingency table (most cells are 0):
> xtabs(~.,data[,idx:(idx+4)])
, , x3 = 1, x4 = 1, x5 = 1
x2
x1 1 2 3
1 0 0 31
2 0 0 112
3 0 0 94
, , x3 = 2, x4 = 1, x5 = 1
x2
x1 1 2 3
1 0 0 0
2 0 0 0
3 0 0 0
, , x3 = 3, x4 = 1, x5 = 1
x2
x1 1 2 3
1 0 0 0
2 0 0 0
3 0 0 0
, , x3 = 1, x4
2013 Apr 13
1
how to add a row vector in a dataframe
Hi,
Using S=1000
and
simdata <- replicate(S, generate(3000))
#If you want both "m1" and "m0" #here the missing values are 0
res1<-sapply(seq_len(ncol(simdata.psm1)),function(i) {x1<-merge(simdata.psm0[,i],simdata.psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1})
res1[,997:1000]
#????? [,1]???????? [,2]???????? [,3]???????? [,4]???????
#x1??? Numeric,3000 Numeric,3000
2016 Apr 22
0
R2BayesX help
Hi,
I wonder if anyone can help me with this issue. I am using R2BayesX. It
seems that the model can maximally contain 20 interactions. When the number
of interaction terms exceed 20, the code stops working. Here is a piece of
toy code.
rm(list=ls())
library(BayesX)
library(R2BayesX)
#data generating model
f2<-function(x1,x2,x3,x4)
{
y<-2*sin(pi*x1)*1.5+exp(2*x2)/3+2 * sin(4 * pi * (x3
2006 Aug 16
1
Specifying Path Model in SEM for CFA
I'm using specify.model for the sem package. I can't figure out how to
represent the residual errors for the observed variables for a CFA
model. (Once I get this working I need to add some further constraints.)
Here is what I've tried:
model.sa <- specify.model()
F1 -> X1,l11, NA
F1 -> X2,l21, NA
F1 -> X3,l31, NA
F1 -> X4,l41, NA
F1 -> X5, NA, 0.20
2012 Aug 10
1
Solving binary integer optimization problem
Hi,
I am new to R for solving optimization problems, I have set of communication
channels with limited capacity with two types of costs, fixed and variable
cost. Each channel has expected gain for a single communication.
I want to determine optimal number of communications for each channel
maximizing ROI)return on investment) with overall budget as constraint.60000
is the budget allocated.
2003 Oct 05
3
stepAIC problem
Dear R-users
I have a probelm running stepAIC in R1.7.1
I wrote a program which used stepAIC as a part of it,
and it worked fine while I was using the previous version of
R1.7.0. However, I found the program did not work any more.
Now, R produces a message which tells
"Error in as.data.frame.default(data) :
can't coerce function into a data.frame" every time I
run the part of
2007 Oct 05
1
creating objects of class "xtabs" "table" in R
I have an application that would generate a cross-tabulation in array
format in R. In particular, my application would give me a result
similar to that of :
array(5,c(2,2,2,2,2))
The above could be seen as a cross-tabulation of 5 variables with 2
levels each (could be 0 and 1). In this case, the data were such that
each cell has exactly 5 observations. I
Now, I want the output to look like the
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
2012 Nov 08
0
mirt vs. eRm vs. ltm vs. winsteps
Dear R-List,
I tried to fit a partial credit model using the "pcmdat" from eRm-package comparing the results of mirt, eRm, ltm and winsteps.
The results where quite different, though. I cannot figure out what went wrong and I do not know which result I can rely on.
This is what I did in R
library(mirt)
#load(file="u3.RData")
2008 Mar 13
0
lars with weights do not match with lm output
I got my posting bounced and sorry if I accidentally post twice.
I have been looking at 'lars' pkg and got puzzled by the behavior of
function 'lars'. I want to do weighted lasso regression and can't get a
match from lars output with lm output. Here is an example:
y = rnorm(10)
x = matrix(runif(50),nrow=10)
X = data.frame(y,x)
z = runif(10)
X = data.frame(y,x,z)
X$z = X$z /
2011 Feb 25
1
help please ..simple question regarding output the p-value inside a function and lm
Dear R community members and R experts
I am stuck at a point and I tried with my colleagues and did not get it out.
Sorry, I need your help.
Here my data (just created to show the example):
# generating a dataset just to show how my dataset look like, here I have x
variables
# x1 .........to X1000 plus ind and y
ind <- c(1:100)
y <- rnorm(100, 10,2)
set.seed(201)
P <-
2012 Sep 12
3
how to create a substraction matrix (subtract a row of every column from the same row in other columns)
Hello
I have data like this
x1 x2 x3 x4 x5
I want to create a matrix similar to a correlation matrix, but with the
difference between the two values, like this
x1 x2 x3 x4 x5
x1 x2-x1 x3-x1 x4-x1 x5-x1
x2 x3-x2 x4-x2 x5-x2
x3 x4-x3 x5-x3
x4 x5-x4
x5
Then I
2008 Dec 22
1
sem package fails when no of factors increase from 3 to 4
#### I checked through every 3 factor * 3 loading case.
#### While, 4 factor * 3 loading failed.
#### the data is 6 factor * 3 loading
require(sem);
cor18<-read.moments();
1
.68 1
.60 .58 1
.01 .10 .07 1
.12 .04 .06 .29 1
.06 .06 .01 .35 .24 1
.09 .13 .10 .05 .03 .07 1
.04 .08 .16 .10 .12 .06 .25 1
.06 .09 .02 .02 .09 .16 .29 .36 1
.23 .26 .19 .05 .04 .04 .08 .09 .09 1
.11 .13 .12 .03 .05 .03
2017 Aug 22
1
boot.stepAIC fails with computed formula
SImplify your call to lm using the "." argument instead of
manipulating formulas.
> strt <- lm(y1 ~ ., data = dat)
and you do not need to explicitly specify the "1+" on the rhs for lm, so
> frm2<-as.formula(paste(trg," ~ ", paste(xvars,collapse = "+")))
works fine, too.
Anyway, doing this gives (but see end of output)"
bst <-