Re: [R] simulation in R

2016-04-22 Thread David L Carlson
I don't think we have enough information to help you with this. 

Do you intent the simulated values for growthrate to be selected from the 
values in daT$growthrate? Or do these values define a distribution of values 
(perhaps ranging between 0 and 1) and the simulation should use that empirical 
distribution? In that case any value of growthrate in the range of 0 and 1 
inclusive is possible.

What is the sample size of the  Monte Carlo simulations? This will have a 
major effect on the ranges since as the sample size increases the range will be 
closer and closer to the range of the growthrate (0 to 1 for condition 3 and 0 
to .5 for condition 1).

In your example of no constraints on food (condition 2), if the growthrate is 
always 1, the range will always be 1 and 1.

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kristi Glover
Sent: Wednesday, April 20, 2016 1:06 AM
To: R-help
Subject: [R] simulation in R

I realized that there was a typo error. I mean "Monte Carlo Simulation"

____
From: R-help <r-help-boun...@r-project.org> on behalf of Kristi Glover 
<kristi.glo...@hotmail.com>
Sent: April 19, 2016 11:48 PM
To: R-help
Subject: [R] simulation in R

Hi R user,
Would you mind to help me to find the range with stochastic events? For example,

daT<-structure(list(sn = 1:14, growthrate = c(0.5, 0.6, 0.7, 0.99,
0.1, 0.3, 0.4, 0.5, 0.5, 0.2, 0.1, 0.4, 0.3, 0.43)), .Names = c("sn",
"growthrate"), class = "data.frame", row.names = c(NA, -14L))

I want to find the ranges of growth rate of the above data using Mote corle 
simulation ( times) under three conditions:
1. very drought ( in that condition growth will not be more than 0.5). [what 
would be the range (max, min ) of the growth rate for this scenario)
2. no constraints of  food (growth will be 1 or 100%) (what would be the range 
(max,min) of growth rate in this scenario?).
3. Control (as it is) (Range??, max.min)

I tried to find whether some one had same problem but I could not find it, is 
it too complicated to write the code in R for this example? your help will be 
highly appreciated.

Sincerely,


KG



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Simulation in R

2013-08-04 Thread Preetam Pal
Hi All,


I want to simulate a random variable X which takes values 1 and 0 with
probabilities 75% and 25% respectively and then repeat the procedure 1
times.

I am sure this is trivial, I tried to look at the help  pages online, but I
can't quite find it.

Appreciate your help.

Thanks and Regards,
Preetam

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simulation in R

2013-08-04 Thread Rui Barradas

Hello,

See the help page for ?sample.

X - sample(0:1, 1, replace = TRUE, prob = c(0.25, 0.75))

Hope this helps,

Rui Barradas

Em 04-08-2013 08:51, Preetam Pal escreveu:

Hi All,


I want to simulate a random variable X which takes values 1 and 0 with
probabilities 75% and 25% respectively and then repeat the procedure 1
times.

I am sure this is trivial, I tried to look at the help  pages online, but I
can't quite find it.

Appreciate your help.

Thanks and Regards,
Preetam

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simulation in R

2013-08-04 Thread Jeff Newmiller
So you looked at some unspecified help pages online and tried some unspecified 
stuff? Try being more specific next time you post. For example, try reading the 
footer of any R-help email. Note that it says read the Posting Guide, and 
provide a reproducible example (at least of what you tried that didn't work). 
Also note that you need to use plain text email for your reproducible examples 
to get through the email system undamaged.

After reading the Posting Guide, the following hint may be of use:
?sample, prob argument.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Preetam Pal lordpree...@gmail.com wrote:
Hi All,


I want to simulate a random variable X which takes values 1 and 0 with
probabilities 75% and 25% respectively and then repeat the procedure
1
times.

I am sure this is trivial, I tried to look at the help  pages online,
but I
can't quite find it.

Appreciate your help.

Thanks and Regards,
Preetam

   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simulation in R

2013-08-04 Thread Preetam Pal
Thank you very much guys


On Sun, Aug 4, 2013 at 3:51 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote:

 On 04/08/2013 09:30, Rui Barradas wrote:

 Hello,

 See the help page for ?sample.

 X - sample(0:1, 1, replace = TRUE, prob = c(0.25, 0.75))

 Hope this helps,


 ?rbinom would have been a better answer since simpler, faster, algorithms
 are available in that case.

 Or even

 as.integer(runif(1)  0.75)


  Rui Barradas

 Em 04-08-2013 08:51, Preetam Pal escreveu:

 Hi All,


 I want to simulate a random variable X which takes values 1 and 0 with
 probabilities 75% and 25% respectively and then repeat the procedure
 1
 times.

 I am sure this is trivial, I tried to look at the help  pages online,
 but I
 can't quite find it.

 Appreciate your help.

 Thanks and Regards,
 Preetam



 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  
 http://www.stats.ox.ac.uk/~**ripley/http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595




-- 
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division,   C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simulation in R

2013-08-04 Thread Prof Brian Ripley

On 04/08/2013 09:30, Rui Barradas wrote:

Hello,

See the help page for ?sample.

X - sample(0:1, 1, replace = TRUE, prob = c(0.25, 0.75))

Hope this helps,


?rbinom would have been a better answer since simpler, faster, 
algorithms are available in that case.


Or even

as.integer(runif(1)  0.75)


Rui Barradas

Em 04-08-2013 08:51, Preetam Pal escreveu:

Hi All,


I want to simulate a random variable X which takes values 1 and 0 with
probabilities 75% and 25% respectively and then repeat the procedure
1
times.

I am sure this is trivial, I tried to look at the help  pages online,
but I
can't quite find it.

Appreciate your help.

Thanks and Regards,
Preetam



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Simulation in R

2012-12-01 Thread mboricgs
Hello!

How can I do 100 simulations of length 17 from bivariate  bivariate normal
distribution, if I know all 5 parameters?



--
View this message in context: 
http://r.789695.n4.nabble.com/Simulation-in-R-tp4651578.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Simulation in R

2012-12-01 Thread Greg Snow
look at functions replicate and mvrnorm functions (the later in the MASS
package).


On Sat, Dec 1, 2012 at 12:02 PM, mboricgs mbori...@hotmail.com wrote:

 Hello!

 How can I do 100 simulations of length 17 from bivariate  bivariate normal
 distribution, if I know all 5 parameters?



 --
 View this message in context:
 http://r.789695.n4.nabble.com/Simulation-in-R-tp4651578.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.