Displaying 20 results from an estimated 20000 matches similar to: "recompute values repeatedly, or new file for glm()?"
2008 May 07
1
Automatically generating new column names (and columns)
Once again I need to tap into the collective knowledge here.
Let's say I have the following columns and data below
Y X1 X2 X3 X4
I would like to generate additional new columns and column names
(ie the data would be squared - and I'd like the column names to
reflect this) like:
Y X1 X2 X3 X4 X1^2 X2^2 X3^2 X4^2
I believe I can compute the values correctly with the code below, but
I
2008 Aug 26
1
A Tip: lm, glm, and retained cases
Hi Folks,
This tip is probably lurking somewhere already, but I've just
discovered it the hard way, so it is probably worth passing
on for the benefit of those who might otherwise hack their
way along the same path.
Say (for example) you want to do a logistic regression of a
binary response Y on variables X1, X2, X3, X4:
GLM <- glm(Y ~ X1 + X2 + X3 + X4)
Say there are 1000 cases in 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
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
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
2005 Oct 25
0
Beginner question on apply()
Dear all,
I am an beginner with R and I have a question concerning apply(). My problem
is as follows:
I have data on four variables (x1,x2,x3,x4) with missing values for x1 and
x2.
> data[1:9,]
x1 x2 x3 x4
1 NA NA 10 1
2 NA NA 8 3
3 NA NA 13 7
4 9 9 9 9
5 11 14 20 10
6 14 14 14 15
7 6 6 6 8
8 4 4 4 19
9 12 12 12 8
.....
I would like to replace the missing values
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 <-
2008 Aug 01
5
drop1() seems to give unexpected results compare to anova()
Dear all,
I have been trying to investigate the behaviour of different weights in
weighted regression for a dataset with lots of missing data. As a start
I simulated some data using the following:
library(MASS)
N <- 200
sigma <- matrix(c(1, .5, .5, 1), nrow = 2)
sim.set <- as.data.frame(mvrnorm(N, c(0, 0), sigma))
colnames(sim.set) <- c('x1', 'x2') # x1 & x2 are
2008 May 13
1
Missing coefficient on a glm object
Hello guys, i looked over the archive files and found nothing about this
kind of error.
I have a database of 33 elements described in 8 variables, i'm using the
Leave-One-Out iterative process
to take one of the elements to be the test element and make a regression
with the other 32 and then
I try to predict the clas of the element out.
I'm using this call as a part of a Leave-One-Out
2012 Jan 05
1
delete.response leaves response in attribute dataClasses
I posted this one as an R bug
(https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14767), but
Prof. Ripley says I'm premature, and I should raise the question here.
Here's the behavior I assert is a bug:
The output from delete.response on a terms object alters the formula
by removing the dependent variable. It removes the response from the
"variables" attribute and it changes
2010 Dec 14
2
How to bind models into a list of models?
Hi R-helpers,
I have a character object called dd that has 32 elements each of which
is a model formula contained within quotation marks. Here's what it
looks like:
> dd
[1] "lm(y ~ 1,data=Cement)" "lm(y ~
X,data=Cement)" "lm(y ~ X1,data=Cement)"
[4] "lm(y ~ X2,data=Cement)" "lm(y ~
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
1999 Aug 05
1
pairwise scatterplot matrix
Dear Friends:
I like so much to work with R program. Congratulations for your work.
I need R for work with multivariate data.
My question is:
With the pairs(X) command my output is a pairwise scatterplot symmetric matrix. Like:
| X1 |X1 vs X2|X1 vs X3|X1 vs X4|
|X2 vs X1| X2 |X2 vs X3|X2 vs X4|
|X3 vs X1|X3 vs X2| X3 |X3 vs X4|
|X4 vs X1|X4 vs X2|X4 vs X3| X4 |
It is
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)
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
2004 Sep 27
1
random discrete from the first tuple
Dear UseR
I have a dataset, for instance x1(A, B, C), x2(M,F), x3(X1,X2,X3,X4)
and x4(W,F,P). I want to make a small dataset with the random tuple. I
know package e1071 can handle a random discrete,
> library(e1071)
> x1 <- rdiscrete(6, c(2,2,2), c("A","B","C"))
> x2 <- rdiscrete(6, c(3,3), c("M","F"))
> x3 <-
2012 Apr 20
1
predictOMatic for regression. Please try and advise me
I'm pasting below a working R file featuring a function I'd like to polish up.
I'm teaching regression this semester and every time I come to
something that is very difficult to explain in class, I try to
simplify it by writing an R function (eventually into my package
"rockchalk"). Students have a difficult time with predict and newdata
objects, so right now I'm
2012 Oct 23
0
lm and glm
Dear list,
I am making a linear regression of the following format.
lm(Y~X1+X2+log(X3)+log(X4))
Now I would like to check the linear regression above using generalized
linear model.
Please kindly if the following format is correct and thank you.
(If it is wrong, please indicate why.)
glm(Y~X1+X2+log(X3)+log(X4), family=poisson(link="log"))
Also, please kindly suggest any references