| Author |
Message |
![]() ![]() ![]() ![]()
Baatasari
Side Hero Username: Baatasari
Post Number: 3178 Registered: 10-2018 Posted From: 71.187.246.172
Rating: N/A Votes: 0 (Vote!) | | Posted on Sunday, March 24, 2019 - 07:42 pm: |
![]() ![]() ![]() ![]() ![]() |
Ballasticmissile:
There is already ready-made code given in the link you pasted.. you seem to make errors on top of it.. there is no x, value to track here - 1)you have the x values inside "i" variable i believe, need to restrict on it.. 2) clearly your are trying to restrict on Area - your condition is wrong & also your code. You need to restrict on x and not on area.. SO lo vadu pettindi just to ensure sanity as best practice.. brahma satyam jagan-mithyä jivo brahmaiva näparah |
![]() ![]() ![]() ![]()
Ballasticmissile
Hero Username: Ballasticmissile
Post Number: 11628 Registered: 07-2012 Posted From: 134.91.44.36
Rating: N/A Votes: 0 (Vote!) | | Posted on Sunday, March 24, 2019 - 03:26 pm: |
![]() ![]() ![]() ![]() ![]() |
Emc2:Where are you tracking the x value? You have to keep Track of X value and condition with in the loop
ah now got it thanks.... Capacity vundi, laziness, and uninspired life is a waste of time. YOLO kada.... But experiences is how you bring meaning to life. Worthiness should be earned with adequate efforts. |
![]() ![]() ![]() ![]()
Ballasticmissile
Hero Username: Ballasticmissile
Post Number: 11627 Registered: 07-2012 Posted From: 134.91.44.36
Rating: N/A Votes: 0 (Vote!) | | Posted on Sunday, March 24, 2019 - 03:12 pm: |
![]() ![]() ![]() ![]() ![]() |
Emc2:
this is the full code...for example .......................................... d0 <- density(sample$sample_x[sample$bad_is_1==0]) d1 <- density(sample$sample_x[sample$bad_is_1==1]) f0 <- approxfun(d0$x, d0$y) f1 <- approxfun(d1$x, d1$y) ovrng <- c(max(min(d0$x), min(d1$x)), min(max(d0$x), max(d1$x))) i <- seq(min(ovrng), max(ovrng), length.out=500) h <- f0(i)-f1(i) area<-sum(>=0+0)) ............................................................ .......... where should I intersect the condition of X as i mentioned in the OP?? Capacity vundi, laziness, and uninspired life is a waste of time. YOLO kada.... But experiences is how you bring meaning to life. Worthiness should be earned with adequate efforts. |
![]() ![]() ![]() ![]()
Ballasticmissile
Hero Username: Ballasticmissile
Post Number: 11626 Registered: 07-2012 Posted From: 134.91.44.36
Rating: N/A Votes: 0 (Vote!) | | Posted on Sunday, March 24, 2019 - 03:07 pm: |
![]() ![]() ![]() ![]() ![]() |
Emc2:Where are you tracking the x value? You have to keep Track of X value and condition with in the loop
code change chesi punyan kattuko uncle...ipptike alasipoya.... Capacity vundi, laziness, and uninspired life is a waste of time. YOLO kada.... But experiences is how you bring meaning to life. Worthiness should be earned with adequate efforts. |
![]() ![]() ![]() ![]()
Emc2
Legend Username: Emc2
Post Number: 74062 Registered: 03-2008 Posted From: 74.96.198.115
Rating: N/A Votes: 0 (Vote!) | | Posted on Sunday, March 24, 2019 - 03:05 pm: |
![]() ![]() ![]() ![]() ![]() |
Where are you tracking the x value? You have to keep Track of X value and condition with in the loop It's ok
|
![]() ![]() ![]() ![]()
Ballasticmissile
Hero Username: Ballasticmissile
Post Number: 11625 Registered: 07-2012 Posted From: 134.91.44.36
Rating: N/A Votes: 0 (Vote!) | | Posted on Sunday, March 24, 2019 - 02:55 pm: |
![]() ![]() ![]() ![]() ![]() |
Hi guys you wont believe this is my 10th continuous hour of Nonstop work in a project...while i am comleting it...i ran into a hurdle in code...if its done most of my project would be wrapped in an hour... here is the problem... https://stackoverflow.com/questions/24742677/how-to-measure- area-between-2-distribution-curves-in-r-ggplot2 in this example....i need to find the area between the curves when X value is greater than 18 but all i am getting is value between the curves... this is the result http://oi65.tinypic.com/6tl3f9.jpg i want to calculate area between the curves whose x value is greater than 18. ............................................................ ................ > ovrng <- c(max(min(dens.pre$x), min(dens.post$x)), min(max(dens.pre$x), max(dens.post$x))) > i <- seq(min(ovrng), max(ovrng), length.out=500) > h <- f0(i)-f1(i) > f0 <- approxfun(dens.post$x, dens.post$y) > f1 <- approxfun(dens.pre$x, dens.pre$y) > h <- f0(i)-f1(i) > area<-sum(>=0+0)) > area ............................................................ ............. in the following code what should i change to get the value between the curves whose X value is greater than 18?? TIA Capacity vundi, laziness, and uninspired life is a waste of time. YOLO kada.... But experiences is how you bring meaning to life. Worthiness should be earned with adequate efforts. |