Displaying 20 results from an estimated 10000 matches similar to: "How can I calculate the error of a fit parameter, when the data set has an error itself?"
2010 Mar 29
0
Error of a fit parameter, of the data set has errors itself?
Hi out there,
imagine you have a dataset (x,y) with errors f,
so that each y_i is y_i +- f_i. This is the normal case for almost all
measurements, since one quantity y can only be measured with a certain
accuracy f.
> x<-c(1,2,3)
> y<-c(1.1,0.8,1.3)
> f<-c(0.2,0.2,0.2)
> plot(x,y) #whereas every y has the uncertainty of f
If I now perform a nls-fit (and force the data
2003 Oct 23
1
Variance-covariance matrix for beta hat and b hat from lme
Dear all,
Given a LME model (following the notation of Pinheiro and Bates 2000) y_i
= X_i*beta + Z_i*b_i + e_i, is it possible to extract the
variance-covariance matrix for the estimated beta_i hat and b_i hat from the
lme fitted object?
The reason for needing this is because I want to have interval prediction on
the predicted values (at level = 0:1). The "predict.lme" seems to
2006 May 05
0
Spline integration & Gaussian quadrature (was: gauss.quad.prob)
Spencer
Thanks for your thoughts on this. I did a bit of work and did end up
with a method (more a trick), but it did work. I am certain there are
better ways to do this, but here is how I resolved the issue.
The integral I need to evaluate is
\begin{equation}
\frac{\int_c^{\infty} p(x|\theta)f(\theta)d\theta}
{\int_{-\infty}^{\infty} p(x|\theta)f(\theta)d\theta}
\end{equation}
Where
2008 Jun 03
3
How to solve a non-linear system of equations using R
Dear R-list members,
I've had a hard time trying to solve a non-linear system (nls) of equations
which structure for the equation i, i=1,...,4, is as follows:
f_i(d_1,d_2,d_3,d_4)-k_i(l,m,s) = 0 (1)
In the expression above, both f_i and k_i are known functions and l, m and s
are known constants. I would like to estimate the vector d=(d_1,d_2,d_3,d_4)
which is solution
2011 Feb 16
0
Constraints in projection pursuit regression
Hi,
I am solving a projection pursuit regression problem, of the
form y = \sum_i f_i (a_i^T x), where a_i are unknown directions, while
f_i are unknown univariate link functions. The following is known about
each f_i:
1. f_i (0) = 0 (that is, each f_i passes through the origin)
2. f_i is monotonic.
Is there a way to ensure that the function ppr() in R produces solutions that respect the
2009 Nov 12
1
naive "collinear" weighted linear regression
Hi there
Sorry for what may be a naive or dumb question.
I have the following data:
> x <- c(1,2,3,4) # predictor vector
> y <- c(2,4,6,8) # response vector. Notice that it is an exact,
perfect straight line through the origin and slope equal to 2
> error <- c(0.3,0.3,0.3,0.3) # I have (equal) ``errors'', for
instance, in the measured responses
Of course the
2008 Dec 01
1
linear functional relationships with heteroscedastic & non-Gaussian errors - any packages around?
Hi,
I have a situation where I have a set of pairs of X & Y variables for
each of which I have a (fairly) well-defined PDF. The PDF(x_i) 's and
PDF(y_i)'s are unfortunately often rather non-Gaussian although most
of the time not multi--modal.
For these data (estimates of gas content in galaxies), I need to
quantify a linear functional relationship and I am trying to do this
as
2004 Dec 15
2
how to fit a weighted logistic regression?
I tried lrm in library(Design) but there is always
some error message. Is this function really doing the
weighted logistic regression as maximizing the
following likelihood:
\sum w_i*(y_i*\beta*x_i-log(1+exp(\beta*x_i)))
Does anybody know a better way to fit this kind of
model in R?
FYI: one example of getting error message is like:
> x=runif(10,0,3)
> y=c(rep(0,5),rep(1,5))
>
2018 Mar 15
0
stats 'dist' euclidean distance calculation
> 3x3 subset used
> Locus1 Locus2 Locus3
> Samp1 GG <NA> GG
> Samp2 AG CA GA
> Samp3 AG CA GG
>
> The euclidean distance function is defined as: sqrt(sum((x_i - y_i)^2)) My
> assumption was that the difference between
2006 Jan 12
1
Problem with NLSYSTEMFIT()
Hello,
I want to solve a nonlinear 3SLS problem with "nlsystemfit()". The
equations
are of the form
y_it = f_i(x,t,theta)
The functions f_i(.) have to be formulated as R-functions. When invoking
"nlsystemfit()" I get the error
Error in deriv.formula(eqns[[i]], names(parmnames)) :
Function 'f1' is not in the derivatives table
2009 Oct 09
0
Help producing plot for assessing forecasting accuracy
Dear colleagues,
I'm trying (and failing) to write the script required to generate a
chart that would help me assess the forecasting accuracy of a logistic
regression model by plotting the cumulative proportion of observed
events occurring in cases across the range of possible predicted
probabilities. In other words, let:
x = any value on 0-1 scale
phat_i = predicted probability of event Y
2018 Jan 17
1
mgcv::gam is it possible to have a 'simple' product of 1-d smooths?
I am trying to test out several mgcv::gam models in a scalar-on-function regression analysis.
The following is the 'hierarchy' of models I would like to test:
(1) Y_i = a + integral[ X_i(t)*Beta(t) dt ]
(2) Y_i = a + integral[ F{X_i(t)}*Beta(t) dt ]
(3) Y_i = a + integral[ F{X_i(t),t} dt ]
equivalents for discrete data might be:
1) Y_i = a + sum_t[ L_t * X_it * Beta_t ]
(2) Y_i
2007 Mar 01
1
covariance question which has nothing to do with R
This is a covariance calculation question so nothing to do with R but
maybe someone could help me anyway.
Suppose, I have two random variables X and Y whose means are both known
to be zero and I want to get an estimate of their covariance.
I have n sample pairs
(X1,Y1)
(X2,Y2)
.
.
.
.
.
(Xn,Yn)
, so that the covariance estimate is clearly 1/n *(sum from i = 1 to n
of ( X_i*Y_i) )
But,
2010 Feb 06
1
Canberra distance
Hi the list,
According to what I know, the Canberra distance between X et Y is : sum[
(|x_i - y_i|) / (|x_i|+|y_i|) ] (with | | denoting the function
'absolute value')
In the source code of the canberra distance in the file distance.c, we
find :
sum = fabs(x[i1] + x[i2]);
diff = fabs(x[i1] - x[i2]);
dev = diff/sum;
which correspond to the formula : sum[ (|x_i - y_i|) /
2011 Dec 13
1
Should I use nls for this?
Hi,
I have a dataset with the following properties:
Y_i ~ N(mu_i, theta * (mu_i)^2)
ln(mu_i) = B'Xi
theta and beta's are the parameters here.
I want to come up with a model to fit the data with the above property and
test that model on the built in R dataset quine.
Does nls() make sense in this case? Or is there any existing R package which
can fit this model?
-Shelly
--
View
2008 May 23
1
maximizing the gamma likelihood
for learning purposes and also to help someone, i used roger peng's
document to get the mle's of the gamma where the gamma is defined as
f(y_i) = (1/gammafunction(shape)) * (scale^shape) * (y_i^(shape-1)) *
exp(-scale*y_i)
( i'm defining the scale as lambda rather than 1/lambda. various books
define it differently ).
i found the likelihood to be n*shape*log(scale) +
2013 Jan 11
0
Manual two-way demeaning of unbalanced panel data (Wansbeek/Kapteyn transformation)
Dear R users,
I wish to manually demean a panel over time and entities. I tried to code
the Wansbeek and Kapteyn (1989) transformation (from Baltagi's book Ch. 9).
As a benchmark I use both the pmodel.response() and model.matrix() functions
in package plm and the results from using dummy variables. As far as I
understood the transformation (Ch.3), Q%*%y (with y being the dependent
variable)
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as
sum(|x_i - y_i| / |x_i + y_i|)
Obviously this is undefined for cases where both x_i and y_i are zeros. Since
double zeros are common in many data sets, this is a nuisance. In our field
(from which the distance is coming), it is customary to remove double zeros:
contribution to distance is zero when both x_i
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as
sum(|x_i - y_i| / |x_i + y_i|)
Obviously this is undefined for cases where both x_i and y_i are zeros. Since
double zeros are common in many data sets, this is a nuisance. In our field
(from which the distance is coming), it is customary to remove double zeros:
contribution to distance is zero when both x_i
2010 Apr 25
1
function pointer question
Hello,
I have the following function that receives a "function pointer" formal parameter name "fnc":
loocv <- function(data, fnc) {
n <- length(data.x)
score <- 0
for (i in 1:n) {
x_i <- data.x[-i]
y_i <- data.y[-i]
yhat <- fnc(x=x_i,y=y_i)
score <- score + (y_i - yhat)^2
}
score <- score/n