function writing

  1. P

    Trying to write R function, binomial distribution

    Hello! I am looking for some help with an Intro to R homework from a professor who doesn't clearly explain the things we need to know for the homework in class...:shakehead:confused: I'm trying to figure out how to write a function to simulate the sampling distribution of the mean when the...
  2. D

    Function code need chang.

    My Original function is: Expect=sum(listP[1,] * 0:t + listP[2,] * 0:t) Loop is: expnumber <- function(x) { n <- nrow(x) m <- ncol(x) sum(t(x) * (1 : m-1 )) } expnumber(listP) However, I found out now my expect value want to be Expect=sum(listP[1,] * 0:t + listP[2,] *...
  3. A

    Testing Randomness (Function Writing): Need HELP PLEASE!!

    Please show all the work asked for I need help big time!!! THANKS!!! The details are in the image for clarity and here is the data so you don't have to retype: x1 <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1...