Displaying 20 results from an estimated 10000 matches similar to: "Binning the data based on a value"
2012 Jul 26
3
Solving quadratic equation in R
Hi there,
I would like to solve a simple equation in R
a^2 - a = 8.313
There is no real solution to this problem but I would like to get an
approximate numerical solution. Can someone suggest how I can set this up?
Thanks in advance,
Diviya
[[alternative HTML version deleted]]
2013 Jan 31
1
LogLik of nls
Hello there,
Can anyone point me to the code for logLik of an nls object? I found the
code for logLik of an lm but could not find exactly what function is used
for calculating the logLik of nls function?
I am using the nls to fit the following model to data -
Model 1: y ~ Ae^(-mx) + Be^(-nx) +c
and want to understand what is the likelihood function used by nls.
Presumably it is using -
2011 Sep 14
2
Optimization package
Hi there,
I have a complex math equation which does not have a closed form solution.
It is -
y <- (p*exp(-a*d)*(1-exp((d-p)*(a-x[1]))))/((p-d)*(1-exp(-p*(a-x[1]))))
For this equation, I have all the values except for x[1]. So I need to solve
this problem numerically. Can anyone suggest an optimization package that I
can use to estimate the value for x[1]?
Thanks in advance,
Diviya
2011 Nov 11
1
barplot names.arg
Hello there,
I have a question regarding bar plots. I am trying to plot the data from
the following matrix as a barplot -
# input data
mdat <- matrix(c(0.1,0.9,0.9,0.1,0.5,0.5,0.45,1-0.45,0.6,0.4,0.8,0.2), nrow
= 6, ncol=2, byrow=TRUE,
+ dimnames = list(c("Mon", "Mon", "Tues", "Tues", "Thurs",
"Friday"),
+
2012 Mar 19
1
Linear regression
Hello there,
I am new to using regression in R. I wanted to solve a simple regression
problem where I have 2 equations and 2 unknowns.
So lets say -
y1 = alpha1*A + beta1*B
y2 = alpha2*A + beta2*B
y1 <- runif(100000, 0,1)
y2 <- runif(100000,0,1)
alpha1 <- 0.6
alpha2 <- 0.75
beta1 <- 1-alpha1
beta2 <- 1-apha2
I now want this equation to estimate the values of A and B. Both A
2012 Dec 21
1
Legend symbols
Hi there,
I was wondering if there is any R package that one can use for plotting
that has more legend symbols - the standard pch has 18 symbols but I need
~30 for my application- and just using different colors is not an option.
Thank you in advance,
Diviya
[[alternative HTML version deleted]]
2011 Dec 08
1
R function implementation
Hello there,
I recently wrote some code to perform pairwise correlations between all
samples in a large dataset. So we are talking about performing pairwise
correlations between 400K vectors. Since R has a very rich library of
functions, it was very easy to code this in R. However, R was probably not
the best choice as it is super slow for this large job. So my plan is to
recode it in C. I was
2012 Oct 03
3
Fastest non-overlapping binning mean function out there?
Hi,
I'm looking for a super-duper fast mean/sum binning implementation
available in R, and before implementing z = binnedMeans(x y) in native
code myself, does any one know of an existing function/package for
this? I'm sure it already exists. So, given data (x,y) and B bins
bx[1] < bx[2] < ... < bx[B] < bx[B+1], I'd like to calculate the
binned means (or sums)
2009 Jun 04
4
Binning or grouping data
Newbie here. Many apologies in advance for using the incorrect lingo. I'm
new to statistics and VERY new to R.
I'm attempting to "group" or "bin" data together in order to analyze them as
a combined group rather than as discrete set. I'll provide a simple example
of the data for illustrative purposes.
Patient ID | Charges | Age | Race
1 |
2008 Jun 18
5
Problem in Binning of a data set
Hello,
I am having problem with binning the data. I have a 50X3 matrix and I binned
the data for all the 3 columns. Using table command I got the total no. of
elements in a particular bin.
Could you please tell me how to see that what all elements are there in a
particular bin and then create a different matrix for each bin?
Thanks.
Regards,
Sumit
[[alternative HTML version deleted]]
2012 Jul 23
2
Solving equations in R
Hi there,
I would like to solve the following equation in R to estimate 'a'. I have
the amp, d, x and y.
amp*y^2 = 2*a*(1-a)*(-a*d+(1-a)*x)^2
test data:
amp = 0.2370 y=
0.0233 d=
0.002 x=
0.091
Can anyone suggest how I can set this up?
Thanks,
Diviya
[[alternative HTML version deleted]]
2008 Aug 19
1
Histogram binning
I am trying to produce frequencies in defined intervals however I can't seem
to figure out how to get R to bin my data the way I want it to.
I have several thousand lengths of fish that I want to be binned as follows:
Ex.
Length Bin
209 200
219 210
431 430
727 720
That is, bins with any length equal to or greater than the lower
2011 Sep 20
1
NLS error
Hello there,
I am using NLS for fitting a complex model to some data to estimate a couple
of the missing parameters. The model is -
y ~ (C+((log(1-r))*exp(-A*d)*(-1+r+exp(d*(A-B)))/(r*(-A*d+d*B+log(1-r)))))
where A, B and C are unknown.
In order to test the model, I generate data by setting values for all
parameters and add some noise (C).
A <- 20
B <- 500
r <- 0.6881
d <-
2011 Jun 12
2
NLS fit for exponential distribution
Hello there,
I am trying to fit an exponential fit using Least squares to some data.
#data
x <- c(1 ,10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
y <- c(0.033823, 0.014779, 0.004698, 0.001584, -0.002017, -0.003436,
-0.000006, -0.004626, -0.004626, -0.004626, -0.004626)
sub <- data.frame(x,y)
#If model is y = a*exp(-x) + b then
fit <- nls(y ~ a*exp(-x) + b, data = sub, start
2011 Jun 12
1
Error in NLS example in the documentation
Hello there,
I am trying to use R function NLS to analyze my data and one of the examples
in the documentation is -
## the nls() internal cheap guess for starting values can be sufficient:
x <- -(1:100)/10
y <- 100 + 10 * exp(x / 2) + rnorm(x)/10
nlmod <- nls(y ~ Const + A * exp(B * x), trace=TRUE)
plot(x,y, main = "nls(*), data, true function and fit, n=100")
curve(100 +
2012 Feb 14
1
Strange plotting error
Hi there,
I am trying to compute the autocorrelation in a dataset using R's acf
function. ACF automatically plots the results. This works well except in
some cases xlim doesnt work
data <- rnorm(2000,0,1)
acf(data,xlim=c(1,10)) # works - the plot starts at 1
acf(data,lag=100,xlim=c(1,100)) # this does not work and the plot still
starts at 0
Is there another way to specify the xlim or
2012 Sep 10
1
Rscript installing packages
Hi there
I have an Rscript and I am looking for a way to install a package
non-interactively. In Rscript {Utils}, I saw an example which does
something like this, however this does not seem to work for my particular
example. I am trying to install the following package in an Rscript
(without switching to interactive mode).
res <- try(install.packages("DEoptim"))
if(inherits(res,
2012 Mar 08
1
binning dates by decade for simulated data
I have a simulated matrix of dates that I generated from a probability
function. Each column represents a single iteration.
I would like to bin each run _separately_ by decades and dump them into a
new matrix where each column is the length of all decades a single run with
the number dates binned by decade.
I have successfully done this for a single vector of dates, but not for a
matrix:
2012 Mar 14
1
How to use ggplot to do the binned quantile plots(one type of scatter plot)?
How to use ggplot to do the binned quantile plots(one type of scatter plot)?
Hi all,
I have done scatter plot: plot(x, y).
Now I wanted to do binned quantile plots... can ggplot2 help me?
For example, we bin x data into 10 bins.
For each bin, we draw the 10 deciles of the corresponding y data in that
bin as points/dots.
And then accross all bins, we would like to connect the corresponding
2010 Jun 18
4
Root mean square on binned GAM results
Hi,
Standard correlations (Pearson's, Spearman's, Kendall's Tau) do not
accurately reflect how closely the model (GAM) fits the data. I was told
that the accuracy of the correlation can be improved using a root mean
square deviation (RMSD) calculation on binned data.
For example, let 'o' be the real, observed data and 'm' be the model data. I
believe I can calculate