function

  1. R

    a function created does not work

    Hello, I had created a function and I aimed to verify if it complies with certain data and if it was, then it is stored in another variable. data = c(12, 20, 11, 16, 18, 32, 22 , 8) class = function(N){} tabla1= c(1:8) for (i in length(N)){ if (data[i]<21.78){ table1[i]= data[i]...
  2. S

    Probability Mass/Density Function

    Hi, I have a matrix of 24x15500 (time x no.of occurrences of an event). The number of occurrences is in the form of binary (0/1). I took the percentage of occurrence for each time, so I ended up getting the following 24x1 matrix. 1 0.999935612645676 1 0.994913399008435 0.973150473247054...
  3. C

    How to generate many load profiles of EV superchargers in R

    Hi guys :wave:, I make balance simulation of load profile electric vehicle chargers in R. I use CHADEMO (45 kW). I need to genarate a lot of profiles. I can make one profile, but it is not convenient. See example: Chademo1=numeric(1440) ### minute time axis a day for...
  4. E

    Total and quadratic variation of a function

    Let f(x)= x2−3, for x<3, x2+3, for x≥3 I need to determine the total variation and the quadratic variation of f(x) on the interval [−4, 4]. For the total variation, I guess I can use my raw way to do it. It means see that f(−4)=13, f(0)=−3, f(2.999999)=5.99999, f(3)=12, f(4)=19. So...
  5. DATAfiend

    Passing a function as an argument

    Hi all, I'm currently taking an online course on R on coursera. I'm at a point in the class where this concept is a little fuzzy to me. Can someone throw an example of this? I'm googling like mad, but comse of the tutorials are a little advanced. Thanks, Randy
  6. L

    Way to pick apart Discriminant Function Analysis?

    Hi there, I'm new to the site, this is my first post! I've run a discriminant function analysis by entering syntax into SPSS. My data consists of sets of fish separated by species, and each species group has individuals ranging from 4 to 53 specimens. I have my output which is showing me...
  7. 3

    Generating peer nomination dataset in R

    Hi all, I have been trying to generate a dataset on peer nominations in R. Often in research participants are asked to nominate others in the peer group (or classroom) as a friend. My requirements Each peer has to nominate x other peers as friends Participants can't select themselves...
  8. S

    Want to know Expression of t.test

    There is a function t.test in R , i want to know the expression of t.test function; how can i know it. Example : We have simple "mean" function in R and i want to know the all expression for calculating mean function or expression written for mean function.
  9. S

    Create simple function to average column over different ranges of rows

    I've learned how to subset a group of rows I am interested in from a matrix, and average those values. The data set shows the percent of light reflected at many different wavelengths (rows). If I want to know the average amount of light reflected at ~900 nm, I use the following code to...
  10. M

    Infinite sum in R

    Hi dear R users, Is there any way for define following function in R? Thanks.
  11. N

    Power of t-test

    Hello all, I want to write an R procedure that calculates the power of a simple two samples t-test. Does anyone here has an idea how to do it ? Thank you !
  12. S

    Converting Numerical Value Ranges into Ordinal Values.

    Hello everbody I need help with 2 issues. First one; When I use calculate values menu, and I create body mass index function from weight and height variables, and I say calculate, spss calculates BMIs and writes them in cells. But when I update information, BMI for that particular case won't...
  13. T

    Function Lines (error when used with fitted values of a truncated regression model)

    Hi everyone, I'm having some trouble with the function lines() in R. Here is an example of the code: <code> x=rnorm(100) y=10+2*x+pmax(x-0.5,0)+pmax(x-0.7,0) model=lm(y~x+pmax(x-0.5,0)+pmax(x-0.7,0)) plot(x,model$fitted.values) lines(x,model$fitted.values) </code> I want the function lines...
  14. L

    how to create a vector from function outputs

    Hi everyone, I'm a complete beginner with R and am trying to use it for my maths project, however I'm getting stuck with what I reckon are some quite elementary things, just because I've never used it before and am teaching myself. This is what I have so far and what I am doing: popr =...
  15. D

    Help finding a multivariable probability density function?

    I'm working on a mathematical modeling problem, where the following diagram will aid my description: http://bnware.ndforums.com/dr_dia.png A signal is detected by two posts which are separated by 5.43 miles (seen on the left side of the diagram.) The blue lines represent the lines of...
  16. B

    cumulative distribution function problem

    I have this question I am trying to get through but i keep coming into trouble. The question is: Show that the cumulative distribution function from a uniform distribution of the random variable is Fx(y) = (y-a) / (b-a) for some a < y < b I've started the question but have become stuck...
  17. P

    Finding Probability Density Function

    Hi guys, I need help with the attached question. Appreciate your quick response.
  18. C

    Iterative data generation

    I have a question about generating data based off of a loop... I am trying to output a 100 x 3 numerical matrix observations that are described by the following: p1_t=(p1_{t-1}*w1_{t-1})/(\bar{w_{t-1}}) p2_t=(p2_{t-1}*w2_{t-1})/(\bar{w_{t-1}}) p3_t=(p3_{t-1}*w3_{t-1})/(\bar{w_{t-1}})...
  19. S

    Simple user-defined function in R

    Hi, i was looking through the forum but unfortunately couldn't find solution for my problem. I need to use simulation to show that sums of independent uniform random variables approach a Gaussian distribution. I want to write function of m, n, a, b , where m is number of simulations, n is size...