0

Build a function in R to calculate the mean and respectively, the variance where the distribution type of the v.a. is transmitted either by a name, or by the mass function in the discrete case, or by the probability density function in the continuous case.

so I have the idea,but I don't know how to implement it in R, especially when you have to introduce the name. Can you show me the start idea?

Phil
  • 7,287
  • 3
  • 36
  • 66
  • What don't you understand? How to write a function? How to take the mean and variance of data? How to structure it in the intended output of this homework? What is `v.a.`? – r2evans Feb 06 '23 at 19:03
  • 2
    Welcome to SO, Ramona Mariana! Questions on SO (especially in R) do much better if they are reproducible and self-contained. By that I mean including attempted code (please be explicit about non-base packages), sample representative data (perhaps via `dput(head(x))` or building data programmatically (e.g., `data.frame(...)`), possibly stochastically), perhaps actual output (with verbatim errors/warnings) versus intended output. Refs: https://stackoverflow.com/q/5963269, [mcve], and https://stackoverflow.com/tags/r/info. (Homework is fine, but ... you need to show research/effort.) – r2evans Feb 06 '23 at 19:03

0 Answers0