Displaying 20 results from an estimated 3000 matches similar to: "get mean from cdf"
2011 Sep 10
1
Variable name with a '-'
My statistics teacher wrote a textbook and included .rdata files for the
problem set data. I downloaded these and opened one of them up. Then I used
the ls() command, and it gave me this:
> ls()
[1] "ex02-12"
However, when i try to use the object, it interprets it as ex02 - 12, and I
get the following error:
> ex02-12
Error: object 'ex02' not found
I don't know why
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 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
1999 Apr 09
7
Error in ppois function (PR#161)
Full_Name: Murray H Smith
Version: 0.63.3
OS: Windows NT
Submission from: (NULL) (130.216.5.57)
The ppois function is displaced by -0.5.
Try:
> ppois(-0.5,1)
[1] 0.3678794
> ppois(-0.51,1)
[1] 0
> ppois(0,1)
[1] 0.3678794
and
> par(mfrow=c(2,1))
> x<-seq(-1,5,0.01)
> plot(x,ppois(x,1),type="s",ylab="F(x)",main="Poisson CDF?")
>
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)))
2009 Sep 10
2
index of min elements in matrix
Hi, All,
How can I get the indices of the minimum elements in a matrix without using
a loop?
For example, if the matrix is
4 5 2
2 8 9
5 2 3
Then I want to output (1,3), (2,1), (3,2).
Thanks,
Annie
[[alternative HTML version deleted]]
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
2009 Aug 08
1
generalized linear models
Hi, R users,
I am trying to use glm to do logistic regression. I know generally when I
have two covariates, say x1 and x2, then I do
fit <- glm(y~x1+x2,famliy='binomial')
But now my covariates form a n*p matrix, say x, so actually each column is a
covariate. So I think I should do
fit <- glm(y~x,family='binomial')
Then I need to predict new data. How should I write the
2011 Aug 11
2
2-dim density plot
Hi All,
I have a 2-dim density defined on 0<x<1, 0<y<1, x<y. I know the exact
formula of the density. How can I visualize it? What plot functions can I
use?
Thanks,
Annie
[[alternative HTML version deleted]]
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((
2018 Dec 04
3
Bug report: Function ppois(0:20, lambda=0.9) does not generate a non-decreasing result.
Le 04/12/2018 ? 11:27, I?aki Ucar a ?crit?:
> On Tue, 4 Dec 2018 at 11:12, <qweytr1 at mail.ustc.edu.cn> wrote:
>> function ppois is a function calculate the CDF of Poisson distribution, it should generate a non-decreasing result, but what I got is:
>>
>>> any(diff(ppois(0:19,lambda=0.9))<0)
>> [1] TRUE
>>
>> Actually,
>>
>>>
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(
2018 Dec 03
2
Bug report: Function ppois(0:20, lambda=0.9) does not generate a non-decreasing result.
function ppois is a function calculate the CDF of Poisson distribution, it should generate a non-decreasing result, but what I got is:
> any(diff(ppois(0:19,lambda=0.9))<0)
[1] TRUE
Actually,
> ppois(19,lambda=0.9)<ppois(18,lambda=0.9)
[1] TRUE
Which could not be TRUE.
Code is tested in both R 3.5.1 and Microsoft R Open 3.5.1.
_
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 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) )