Displaying 20 results from an estimated 6000 matches similar to: "Variable name with a '-'"
2011 Sep 09
3
get mean from cdf
Hi All,
How can I get the expected value from a discrete cdf? Is there any R
function that can do this?
Thanks,
Annie
[[alternative HTML version deleted]]
2011 Aug 13
1
Latent flaw in SEXPREC definition
There seems to be a latent flaw in the definition of struct SEXPREC
in Rinternals.h, which likely doesn't cause problems now, but could
if the relative sizes of data types changes.
The SEXPREC structure contains a union that includes a primsxp,
symsxp, etc, but not a vecsxp. However, in allocVector in memory.c,
zero-length vectors are allocated using allocSExpNonCons, which
appears to
2011 Aug 03
2
syntax with do.call and `[`
Dear List,
i would like to mimic the behaviour or the following indexing with a do.call construct to be able to supply the arguments to `[` as a list:
test = matrix[1:4,2]
result = test[2,]
My try, however, did not work:
result = do.call(`[`,list(test,2,NULL))
result = do.call(`[`,list(test,2,))
result = do.call(`[`,list(test,2,''))
How can I use the do.call in that way with
2011 Aug 01
3
formula used by R to compute the t-values in a linear regression
Hello,
I was wondering if someone knows the formula used by the function lm to compute the t-values.
I am trying to implement a linear regression myself. Assuming that I have K variables, and N observations, the formula I am using is:
For the k-th variable, t-value= b_k/sigma_k
With b_k is the coefficient for the k-th variable, and sigma_k =(t(x) x )^(-1) _kk is its standard deviation.
2011 Jul 23
2
sum part of a vector
Dear colleagues, I have a data set that looks roughly like this;
mydat<-data.frame(state=c(rep("Alabama", 5), rep("Delaware", 5), rep("California", 5)), news=runif(15, min=0, max=8), cum.news=rep(0, 15))
For each state, I'd like to cumulatively sum the value of "news" and make that put that value in cum.news.
I'm trying as follows but I get
2011 Sep 20
1
difficulty with 'parallel' in building r57032 -- missing Makefile?
From SVN revision 57032, with configuration
R is now configured for i686-pc-linux-gnu
Source directory: .
Installation directory: /usr/local
C compiler: gcc -std=gnu99 -g -O2
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11
2011 Sep 07
2
reporting ANOVA for nested models
I have the following results for an ANOVA comparing two nested models. I
wasn't sure how I am supposed to report this result in the area of
psychology. Specifically, am I supposed to report the DF's or just the F
ratio? I could manually calculate the degrees of freedoms, but there must be
a reason why R does not give this information, i.e. those are not
conventionally used in the
2011 Aug 06
1
How set lm() to don't return NA in summary()?
Hi,
I've data from an incomplete fatorial design. One level of a factor doesn't
has the levels of the other. When I use lm(), the summary() return NA for
that non estimable parameters. Ok, I understant it. But I use
contrast::contrast(), gmodels::estimable(), multcomp::glht() and all these
fail when model has NA estimates. This is becouse vcov() and coef() has
different dimensions. Is
2011 Aug 02
2
Memory limit in Aggregate()
Dear all,
I am trying to aggregate a table (divided in two lists here), but get a
memory error.
Here is the code I'm running :
sessionInfo()
print(paste("memory.limit() ", memory.limit()))
print(paste("memory.size() ", memory.size()))
print(paste("memory.size(TRUE) ", memory.size(TRUE)))
print(paste("size listX ", object.size(listX)))
2011 Aug 01
3
Beta fit returns NaNs
Hi,
sorry for repeating the question but this is kind of important to me and i
don't know whom should i ask.
So as noted before when I do a parameter fit to the beta distr i get:
fitdist(vectNorm,"beta");
Fitting of the distribution ' beta ' by maximum likelihood
Parameters:
estimate Std. Error
shape1 2.148779 0.1458042
shape2 810.067515 61.8608126
Warning
2011 Aug 02
3
Inverse of FAQ 7.31.
Why does R think these numbers ***are*** equal?
In a somewhat bizarre set of circumstances I calculated
x0 <- 0.03580067
x1 <- 0.03474075
y0 <- 0.4918823
y1 <- 0.4474461
dx <- x1 - x0
dy <- y1 - y0
xx <- (x0 + x1)/2
yy <- (y0 + y1)/2
chk <- yy*dx - xx*dy + x0*dy - y0*dx
If you think about it ***very*** carefully ( :-) )
2011 Aug 01
4
fill Matrix quicker
dear all,
i have a quite simple question, i want to fill up a Matrix like done in the
following function,
but the performance is very bad for large dimensions
is there a way to do this like with apply or something similar?
makeMatrix <- function(a, b,dim) {
X=matrix(0,ncol=dim,nrow=dim)
for (i in c(1:dim)){
for (j in c(1:dim)) {
if (i==j) {X[i,j]<-a}
else { X[i,j]<- exp((
2011 Aug 12
2
Getting data from an *.RData file into a data.frame object.
Hi, all.
I'm new to R. I've been a SAS programmer for 20 years.
I seem to be having trouble with the most basic task - bringing a table in
an *.RData file into a data.frame object.
Here's how I created the *.RData file.
library(RODBC)
db <- odbcConnect("*******")
df <- sqlQuery(
db
, "select * from schema.table where year(someDate)=2006"
)
save(
2011 Jul 29
2
Different result on using apply.
Dear R-helpers,
In the following example I compute ret and returns the SAME way. In ret I
use compute returns for EACH column and in returns I do it for the whole
data frame. Could someone please tell me why I see a lagged result,by which
I mean ret and returns are different by one lag.
getSymbols("GOOG",src="yahoo")
ret<-apply(GOOG,2,function(x) diff(log(x)) / lag(x,1) )
2011 Aug 08
3
on "do.call" function
Dear all,
Even though one of R users answered my question, I cannot understand, so I
re-ask this question.
I am trying to use "do.call", but I don't think I totally understand this
function.
Here is an simple example.
--------------------------------------------
> B <- matrix(c(.5,.1,.2,.3),2,2)
> B
[,1] [,2]
[1,] 0.5 0.2
[2,] 0.1 0.3
> x <- c(.1,.2)
>
2011 Aug 03
3
R.app installer probs on Snow Leopard
Have tried to install R.app several times (6, in fact: versions 2.12, 13 & 14, both 32 and 64 bit versions), using packages freshly downloaded from the official project page, and failed every time, given exception reports such as the following (appended below, the 2 reports arising out of my 1st & 6th attempts).
Machine & software version specifics are all contained therein.
What
2011 Sep 08
1
lmtp -- save failed to INBOX: BUG: Unknown internal error
I've had 18 instances of this error the last 24 hours:
Sep 8 08:56:00 popimap1 dovecot:: lmtp(10529, first.last at example.om): mGdAOtdlaE4hKQAAg/aw4w: msgid=<B8FA3D5B230184409450D51D522678404E5052 at ASP-EX02.ASP.lan>: save failed to INBOX: BUG: Unknown internal error
17 on lmtp-server A, and one on lmtp-server B.
On server A it was a message with 55 recepients, where 17 failed
2015 Jul 13
2
Crear datos aleatorios con restriciones
Hola,
Esta pregunta la hice en stackoverflow
<http://stackoverflow.com/questions/31137940/randomly-assign-teachers-to-classrooms-imposing-restrictions/31143808#31143808>pero
nadie pudo contestarla.
1. Quiero generar N escuelas, con G grados y C divisiones.
2. Quiero asignar cada uno de T maestros a 2 divisiones en un grado y
escuela
Si tengo C=4 divisiones, puedo lograr lo que quiero con
2015 Jul 13
2
Crear datos aleatorios con restriciones
Hola,
0. La falta de 'elegancia' hace que sea mas dificil hacer cambios al
codigo. Por ejemplo cambiar n.classrooms <- 4 a n.classrooms <- 20
1. Cuando tengo solo 4 puedo hacer esto:
schoolGrade$A <- Teachers$Teacher.ID[1:cuttoff1]
schoolGrade$B <- Teachers$Teacher.ID[1:cuttoff1]
schoolGrade$C <- Teachers$Teacher.ID[(cuttoff1+1):n.teachers]
schoolGrade$D <-
2015 Jul 13
2
Crear datos aleatorios con restriciones
Gracias Carlos,
Tu codigo es un gran paso en el sentido correcto pero no produce
exactamente lo que estoy buscando.
Mi "solucion" en stackoverflow
<http://stackoverflow.com/questions/31137940/randomly-assign-teachers-to-classrooms-imposing-restrictions/31143808#31143808>
produce un data frame `schoolGrade` con 240 observaciones y 7 variables. Mi
objetivo es poder generar un data