[R] Normalized 2-D cross-correlation

2013-03-15 Thread Felix Nensa
Hi all,

I need to do (normalized) 2-D cross-correlation in R. There is a convenient
function available in Matlab (see:
http://www.mathworks.de/de/help/images/ref/normxcorr2.html).
Is there anything comparable in R available?

Thanks,

Felix

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Agreement and Consistency of 2D data

2013-03-05 Thread Felix Nensa
Hi,

I have two different imaging modalities (for the identification of areas of
infarcted myocardium) that I need to compare regarding agreement and
consistency.
However, I don't think that methods like Cohen's Kappa, PCC, Bland-Altmann
or ICC are sufficient here as there is not just a pairwise but also a
spatial relationship between measured data points. For example if the
results of the two imaging modalities are slightly misaligned their
agreement might be still much better than the mentioned tests might
indicate (at least from a practical point of view). On the other hand the
number of non-infarcted myocardial segments often heavily outweighs the
number of infarcted segments which seems to introduce a bias towards better
agreement in most examinations.

Here is an example data set, where I've calculated the ICC.
What would be the correct way to assess agreement and consistency here?

# modality 1
lgemtx - as.matrix(read.table('
http://cluster010.ovh.net/~myvideoc/R20130305/lge_mtx.csv'))

# modality 2
petmtx - as.matrix(read.table('
http://cluster010.ovh.net/~myvideoc/R20130305/pet_mtx.csv'))

# ICC
# note: modalities are inverse
# thus in modality1 0 denotes a normal segment and 100 a complete
infarction of the segment
# and vice versa in modality2
library(irr)
print(icc(cbind(100 - c(pet_mtx), c(lge_mtx)), model=twoway, type=c))
print(icc(cbind(100 - c(pet_mtx), c(lge_mtx)), model=twoway, type=a))


If the matrices are mapped to polar plots (also called bullseye plots) one
can visually assess their agreement.
Each matrix row defines one circle starting at 0° with columns equally
mapped to segments of 3,6° width.
The first row defines the outmost circle, the last row defines the inner
circle.
Here are the corresponding plots for the matrices given above (red is
infarction).

http://cluster010.ovh.net/~myvideoc/R20130305/LGE.png
http://cluster010.ovh.net/~myvideoc/R20130305/PET.png

I know, this is not a pure R question but more a general statistical one.
Hopefully it is still ok to post it here :-)

Best, Felix

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Non linear Regression: singular gradient matrix at initial parameter estimates

2011-04-12 Thread Felix Nensa
Hi Peter,

thank you for your reply. Now I see, that P3 is indeed redundand.
But with the simplified model...

fit = nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x))

...nls still produces the same error.
Any ideas?

Felix

2011/4/12 Peter Ehlers ehl...@ucalgary.ca

 On 2011-04-11 13:29, Felix Nensa wrote:

 Hi,

 I am using nls to fit a non linear function to some data but R keeps
 giving
 me singular gradient matrix at initial parameter estimates errors.
 For testing purposes I am doing this:

 ### R code ###

 x- 0:140
 y- 200 / (1 + exp(17 - x)/2) * exp(-0.02*x) # creating 'perfect' samples
 with fitting model
 yeps- y + rnorm(length(y), sd = 2) # adding noise

 # results in above error
 fit = nls(yeps ~ p1 / (1 + exp(p2 - x) / p3) * exp(p4 * x))

 ###

  From what I've found in this list I think that my model is
 over-parameterized.

 How can I work around that?


 Take out p3; it's redundant.

 Peter Ehlers

  Thanks,

 Felix

[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Non linear Regression: singular gradient matrix at initial parameter estimates

2011-04-12 Thread Felix Nensa
Hi Mario,
yes works great. Thanks!

2011/4/12 Mario Valle mva...@cscs.ch

 Use a more realistic starting point instead of the default one:

 fit - nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x),
 start=list(p1=410,p2=18,p4=-.03))

 This works for me:
  fit
 Nonlinear regression model
  model:  yeps ~ p1/(1 + exp(p2 - x)) * exp(p4 * x)
   data:  parent.frame()
   p1p2p4
 199.48276  16.28664  -0.01987
  residual sum-of-squares: 560.6

 Number of iterations to convergence: 5
 Achieved convergence tolerance: 5.637e-07

 Ciao!
mario


 On 12-Apr-11 18:01, Felix Nensa wrote:

 fit = nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x))


 --
 Ing. Mario Valle
 Data Analysis and Visualization Group|
 http://www.cscs.ch/~mvalle
 Swiss National Supercomputing Centre (CSCS)  | Tel:  +41 (91) 610.82.60
 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82




-- 
Felix Nensa

Luisenstr. 15-17
44787 Bochum
Germany

mail: felix.ne...@googlemail.com
mobile: +49 171 958 51 40

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Non linear Regression: singular gradient matrix at initial parameter estimates

2011-04-11 Thread Felix Nensa
Hi,

I am using nls to fit a non linear function to some data but R keeps giving
me singular gradient matrix at initial parameter estimates errors.
For testing purposes I am doing this:

### R code ###

x - 0:140
y - 200 / (1 + exp(17 - x)/2) * exp(-0.02*x) # creating 'perfect' samples
with fitting model
yeps - y + rnorm(length(y), sd = 2) # adding noise

# results in above error
fit = nls(yeps ~ p1 / (1 + exp(p2 - x) / p3) * exp(p4 * x))

###

From what I've found in this list I think that my model is over-parameterized.
How can I work around that?
Thanks,

Felix

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.