Displaying 20 results from an estimated 200 matches similar to: "Arrays and functions"
2008 Apr 12
0
FW:
Hi, I'm doing a stats project using R to work out the size of a t-test and wilcoxon test depending on the distribution and sample size. I just can't get it to work - I want to put my results from the function size() into an array.At the moment I keep getting the error message:Error in res[distribution, test, samplesize] <- results : subscript out of boundsCan anyone tell me where
2009 Sep 18
1
lapply - value changes as parameters to function?
Hi,
I'm trying to get better at things like lapply but it still stumps
me. I have a function I've written, tested and debugged using
individual calls to the function, ala:
ResultList5 = DoAvgCalcs(IndexData, Lookback=5,
SampleSize=TestSamples , Iterations=TestIterations )
ResultList8 = DoAvgCalcs(IndexData, Lookback=8,
SampleSize=TestSamples , Iterations=TestIterations )
ResultList13
2010 Jul 22
1
How do I get rid of list elements where the value is NULL before applying rbind?
Here is the function that makes the data.frames in the list:
funweek <- function(df)
if (length(df$elapsed_time) > 5) {
res = fitdist(df$elapsed_time,"exp")
year = df$sale_year[1]
sample = df$sale_week[1]
mid = df$m_id[1]
estimate = res$estimate
sd = res$sd
samplesize = res$n
loglik = res$loglik
aic = res$aic
bic = res$bic
chisq =
2018 Oct 04
2
Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
Hi Hugo,
I've been able to replicate your bug, including for other distributions (runif, rexp, rgamma, etc) which shouldn't be surprising since they're probably all drawing from the same pseudo-random number generator. ?Interestingly, it does not seem to depend on the choice of seed, I am not sure why that is the case.
I'll point out first of all that the R-devel mailing list is
2018 Oct 04
2
Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
Hi Hugo,
I've been able to replicate your bug, including for other distributions (runif, rexp, rgamma, etc) which shouldn't be surprising since they're probably all drawing from the same pseudo-random number generator. ?Interestingly, it does not seem to depend on the choice of seed, I am not sure why that is the case.
I'll point out first of all that the R-devel mailing list is
2011 Mar 25
1
Appending data to a data.frame and writing a csv
Dear R helpers
exposure <- data.frame(id = c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20),
ead = c(9483.686,50000,6843.4968,10509.37125,21297.8905,50000,706152.8354, 62670.5625, 687.801995,50641.4875,59227.125,43818.5778,52887.72534,601788.7937, 56813.14859,4012356.056,1419501.179,210853.4743,749961,6599.0862),
pd =
2001 Dec 09
1
Help for Power analysis
Dear colleague,
I not sure this R code is correctly ? I would to show
the number of Sample Size at Sample Size Axis that line
draw from Power Axis (80%) from R code.
How I show this and select the most appropriate of
this power (.79955687 - 80983575).
Thank for your help and answer.
Best Regards,
Nikom Thanomsieng,
Email: nikom at kku.ac.th
....
#Power analysis: Sample size for
2010 Aug 11
1
sem & psych
Dear R users,
I am trying to simulate some multitrait-multimethod models using the
packages sem and psych but whatever I do to deal with models which do not
converge I always get stuck and get error messages such as these:
"Error in summary.sem(M1) : coefficient covariances cannot be computed"
"Error in solve.default(res$hessian) : System ist f?r den Rechner singul?r:
reziproke
2010 Sep 19
1
Weibull- Random Censoring
I generate random vector from Weibull distribution
sampWB <-urweibull(sampleSize, shape=shape.true, scale=scale.true, lb=0, ub=Inf)
how can I create subvector containing 30% of samplesize of sampWB which should be assigned as Censored data?
The probability for each value in sampWB can be uniform to be included in the subvector.
2006 Mar 12
1
meta / lme
Hi
I'm conducing a meta-analysis using the meta package.
Here's a bit of code that works fine -
tmp <- metacont(samplesize.2, pctdropout.2, sddropout.2,
samplesize.1, pctdropout.1, sddropout.1,
data=Dataset, sm="WMD")
I would now like to control for a couple of variables (continuous and
categorical) that aren't in the equation.
Is meta
2010 Sep 20
1
Removing slected values from original vector and definning new vector with the rest?
sampleSize <- 20
shape.true <- 1.82
scale.true <- 987
sampWB <- rweibull(sampleSize, shape=shape.true, scale=scale.true)
print(sampWB)
censidx <- sample(1:length(sampWB), length(sampWB)*0.3)
Censored.data <- sampWB[censidx]
noncensidx <- defines the rest values of the vector which is not included at Censored.data?
[[alternative HTML version deleted]]
2010 Sep 16
1
Weibull simulation- number of items to replace is not a multiple of replacement length
Hi,
I write below code for simulation for weibull- estimating parameters by weibullMLE function,
Although I define metrix for the variables still I got this message: number of items to replace is not a multiple of replacement length
Any suggestion
> est=matrix (NA, 2,2)
> se=matrix (NA, 2,2)
> for ( p in 1:2) {
+ sampleSize <- 20
+ shape.true <- 1.82
+ scale.true <- 987
+
2004 May 26
1
Turning pass/fail results into a proportion
Please forgive me, I feel exceptionally like a newbie. Although I've
read screeds of documentation, I just can't see how this is done.
I have a data frame that contains a number of pass/fails for certain
variable sizes. From that, I would like to form another data frame that
contains the proportions of pass/fails per variable.
So, for example:
df <- data.frame( Var=c(3,3,3,4,4),
2004 Sep 24
1
algorithm reference for sample()
Hi,
Don't know if it belongs to r-devel or r-help, but since I am planning
to alter some of R's internal code I am sending it here.
The existing implementation of the sample() function, when the optional
'prob' argument is given, is quite inefficient. The complexity is
O(sampleSize * universeSize), see ProbSampleReplace() and
ProbSampleNoReplace() in random.c. This makes the
2011 Mar 15
1
sample size of 2 groups of skewed data
Hi all:
I have a question on sample size calculation of 2 groups of data. If 2
groups of data are all normal distribution, then I can use the function
"n.indep.t.test.eq" from samplesize package.But if 2 groups of data are all
skewed distribution, but not normal distribution,how can I calculate the
sample size then?
I've tried many transformation (e.g. log arcsin…) in order to
2008 May 10
1
writing a table in the device (pdf in this case)
hello all,
I would like to introduce a summary table into the pdf along with the
plots (in order to archive my data into single files automatically).
Similarly, It would be great to have the result of the statistical
analysis (for instance anova) in the same file.
Is there a way to do that?
example:
pdf("example.pdf")
layout (matrix(1:2,1,2))
plot (groups, scores)
Result <-
2004 Sep 24
1
algorithm reference for sample() - Knuth
Thank you for the reference to Knuth. Indeed in vol. 2 he has a
> -----Original Message-----
> From: Tony Plate [mailto:tplate@blackmesacapital.com]
> Sent: Friday, September 24, 2004 8:05 AM
> To: Vadim Ogranovich
> Subject: Re: [Rd] algorithm reference for sample()
>
> Have you tried looking in Knuth's books on computer
> algorithms? (They are classics for good
2009 Jun 07
1
Survreg function for loglogistic hazard estimation
I am trying to use R to do loglogistic hazard estimation. My plan is to
generate a loglogistic hazard sample data and then use survreg to estimate
it. If everything is correct, survreg should return the parameters I have
used to generate the sample data.
I have written the following code to do a time invariant hazard estimation.
The output of summary(modloglog) shows the factor loading of
2018 Oct 05
2
Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
On 05/10/2018, 09:45, "R-help on behalf of hmh" <r-help-bounces at r-project.org on behalf of hugomh at gmx.fr> wrote:
Hi,
Thanks William for this fast answer, and sorry for sending the 1st mail
to r-help instead to r-devel.
I noticed that bug while I was simulating many small random walks using
c(0,cumsum(rnorm(10))). Then the negative
2013 Feb 12
0
Speexdec says: 'This doesn't look like a Speex file' (am I missing headers?)
Hello, guys!
I'm a novice at programming, learning about the speex and its applications
now. Specifically, my current goal is to encode microphone input on iOS
device in real-time, saving result to a file frame-by-frame.
So far, I've managed to:
1) compile speex static library (it works, at least for iPhone/iPad, but
not on iOS simulator; this is fine for now);
2) encode pcm data from