Displaying 20 results from an estimated 2000 matches similar to: "Simulation based on runif to get mean"
2018 Jan 30
1
Simulation based on runif to get mean
Hello,
Another way would be to use ?replicate and ?colMeans.
set.seed(2511) # Make the results reproducible
fun <- function(n){
f <- function(){
a <- runif(5, 1, 10)
b <- runif(5, 10, 20)
colMeans(cbind(a, b))
}
replicate(n, f())
}
fun(10)
Hope this helps,
Rui Barradas
On 1/30/2018 8:58 AM, Daniel Nordlund wrote:
> On 1/29/2018
2018 Jan 30
0
Simulation based on runif to get mean
On 1/29/2018 9:03 PM, smart hendsome via R-help wrote:
> Hello everyone,
> I have a question regarding simulating based on runif.? Let say I have generated matrix A and B based on runif. Then I find mean for each matrix A and matrix B.? I want this process to be done let say 10 times. Anyone can help me.? Actually I want make the function that I can play around with the number of simulation
2018 Jan 30
2
Simulation based on runif to get mean
Hello everyone,
I have a question regarding simulating based on runif.? Let say I have generated matrix A and B based on runif. Then I find mean for each matrix A and matrix B.? I want this process to be done let say 10 times. Anyone can help me.? Actually I want make the function that I can play around with the number of simulation process that I want. Thanks.
Eg:
a <- matrix(runif(5,1, 10))
2018 Jan 29
0
Result show the values of fitting gamma parameter
Capture the results of the apply command into an object and then work with
that. Here is one way to do it:
> res <- apply(C, 2, fitdist, "gamma")
> out <- c( res$A$estimate["shape"], res$B$estimate["shape"],
res$A$estimate["rate"], res$B$estimate["rate"])
> names(out) <- c("A shape","B shape","A
2018 Jan 29
2
Result show the values of fitting gamma parameter
Hi,
Let say I have data by two columns A and B, and I have fit each column using the gamma distribution by 'fitdist' . I just want the result show only the shape and rate only.
Eg:
library(fitdistrplus)
A <-c(1,2,3,4,5)
B<-c(6,7,8,9,10)
C <-cbind(A,B)
apply(C, 2, fitdist, "gamma")
Output show like this:
$A
Fitting of the distribution ' gamma ' by maximum
2018 May 27
1
if else with 4 conditions problem
Hi everyone,
I have two columns:
? ?A? ? ? ? ? ? ? ?B
? ?1? ? ? ? ? ? ? ?1? ?1? ? ? ? ? ? ? ?0
? ?0? ? ? ? ? ? ? ?1
? ?0? ? ? ? ? ? ? ?0
I have 4 categories which are:
1) if A = 1 and B =1 then A1 = 1, else A2 = 0, A3 = 0, A4 = 0
2) if A = 1 and B =0 then A1 = 0, else A2 =1, A3 = 0, A4 = 0
3) if A = 0 and B = 1 then A1 = 0, else A2 = 0, A3 = 1, A4 = 0
4) if A = 0 and B =0 then A1 = 0, else A2 =
2016 Apr 15
0
aggregate combination data
Hello,
I'm cc'ing R-Help.
Sorry but your question was asked 3.5 years ago, I really don't
remember it. Can you please post a question to R-Help, with a
reproducible example that describes your problem?
Rui Barradas
?
Citando catalin roibu <catalinroibu at gmail.com>:
> Dear Rui,
> ?
> I helped me some time ago with a code..... regarding aggregated data
>
2018 Feb 05
0
find unique and summerize
Thank you so much Rui!
On Sun, Feb 4, 2018 at 12:20 AM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> Please always cc the list.
>
> As for the question, I believe the following does it.
>
> a <- strsplit(mydata$ID, "[[:alpha:]]+")
> b <- strsplit(mydata$ID, "[[:digit:]]+")
>
> a <- sapply(a, `[`, 1)
> c <-
2018 Aug 05
0
Is this a bug in `[`?
This is Circle 8..1.13 of the R Inferno.
On 05/08/2018 06:57, Rui Barradas wrote:
> Thanks.
> This is exactly the doubt I had.
>
> Rui Barradas
>
> ?s 05:26 de 05/08/2018, Kenny Bell escreveu:
>> This should more clearly illustrate the issue:
>>
>> c(1, 2, 3, 4)[-seq_len(4)]
>> #> numeric(0)
>> c(1, 2, 3, 4)[-seq_len(3)]
>> #> [1] 4
2012 Sep 18
0
Appending many different and separate Excel files using R
Hello,
This is the sort of question that could interess others, so you should
have CCed it to the list.
As for the question, from the package vignette, section 3.3.6:
"writeWorksheetToFile() is a wrapper function, calling loadWorkbook(),
createSheet() and saveWorkbook()
functions subsequently. It therefore allows for writing data into
worksheets of an Excel file in one call."
To
2017 Nov 05
0
Extreme bunching of random values from runif with Mersenne-Twister seed
> On 5 Nov 2017, at 15:17 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
> On 04/11/2017 10:20 PM, Daniel Nordlund wrote:
>> Tirthankar,
>> "random number generators" do not produce random numbers. Any given
>> generator produces a fixed sequence of numbers that appear to meet
>> various tests of randomness. By picking a seed you enter
2018 Aug 05
2
Is this a bug in `[`?
Thanks.
This is exactly the doubt I had.
Rui Barradas
?s 05:26 de 05/08/2018, Kenny Bell escreveu:
> This should more clearly illustrate the issue:
>
> c(1, 2, 3, 4)[-seq_len(4)]
> #> numeric(0)
> c(1, 2, 3, 4)[-seq_len(3)]
> #> [1] 4
> c(1, 2, 3, 4)[-seq_len(2)]
> #> [1] 3 4
> c(1, 2, 3, 4)[-seq_len(1)]
> #> [1] 2 3 4
> c(1, 2, 3, 4)[-seq_len(0)]
2018 May 02
0
Merging dataframes
Thanks, Peter, Eivind and Lui
Sorry, I could not explain it properly in the first go. Trying to simplify it here with an example - Say I have two dataframes as below that are not equally-sized data frames:
Table_A:
Email Name Phone
abc at gmail.com<mailto:abc at gmail.com> John Chan 0909
bcd at yahoo.com<mailto:bcd at yahoo.com> Tim Ma
2018 Aug 05
0
Is this a bug in `[`?
This should more clearly illustrate the issue:
c(1, 2, 3, 4)[-seq_len(4)]
#> numeric(0)
c(1, 2, 3, 4)[-seq_len(3)]
#> [1] 4
c(1, 2, 3, 4)[-seq_len(2)]
#> [1] 3 4
c(1, 2, 3, 4)[-seq_len(1)]
#> [1] 2 3 4
c(1, 2, 3, 4)[-seq_len(0)]
#> numeric(0)
Created on 2018-08-05 by the reprex package (v0.2.0.9000).
On Sun, Aug 5, 2018 at 3:58 AM Rui Barradas <ruipbarradas at sapo.pt>
2023 Dec 14
0
R-help Digest, Vol 250, Issue 13
Kevin,
Maybe also look at what air quality monitoring is being done in area.
https://cran.r-project.org/web/packages/RAQSAPI/vignettes/RAQSAPIvignette.html
Depends what and how near, but might be something relevant there?
Karl
Dr Karl Ropkins
Transport Studies | Environment | University of Leeds
------------------------------
Message: 2
Date: Tue, 12 Dec 2023 07:52:59 -0800
From: Bert Gunter
2018 Aug 29
0
Is this a bug in `[`?
FYI, this behavior is documented in Section 3.4.1 'Indexing by
vectors' of 'R Language Definition' (accessible for instance via
help.start()):
"*Integer* [...] A special case is the zero index, which has null
effects: x[0] is an empty vector and otherwise including zeros among
positive or negative indices has the same effect as if they were
omitted."
The rest of that
2020 Oct 01
0
Help with the Error Message in R "Error in 1:nchid : result would be too long a vector"
Hello Rui,
Thanks a lot for your response. But, I will surely say that the data I
attached is in long format as it has 18 rows (3 alternatives*3
questions* 2 individuals). Had it been a wide format data it would
have had 6 rows (3 questions* 2 individuals). But, anyway thanks.
Best,
Rahul
On Wed, Sep 23, 2020 at 3:23 AM Rui Barradas <ruipbarradas at sapo.pt> wrote:
>
> Hello,
>
2017 Nov 05
0
Extreme bunching of random values from runif with Mersenne-Twister seed
Tirthankar,
"random number generators" do not produce random numbers. Any given
generator produces a fixed sequence of numbers that appear to meet
various tests of randomness. By picking a seed you enter that sequence
in a particular place and subsequent numbers in the sequence appear to
be unrelated. There are no guarantees that if YOU pick a SET of seeds
they won't produce
2012 Jul 27
2
How can I access an element of a string?
Dear Daniel and Jorge,
Thank you very much and it does help.
If I have a string "ABCD", how can I access the second element of the
string "B"? Thanks,
Miao
2012/7/27 Daniel Nordlund <djnordlund@frontier.com>
> > -----Original Message-----
> > From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org]
> > On Behalf Of jpm miao
2017 Oct 26
0
Help_urgent_how to calculate mean and sd in biomod 2
Ol?,
Please keep this in the list, I'm cc-ing r-help at r-project.org. And yes,
I am Portuguese but R-Help is a mailing list in the English language.
As for your new question, I believe that you should start a new thread.
This is completely different from the question on computing mean and sd.
Ask a new question.
Font "arial" is a Microsoft font and as far as I know is not