# Blog Archives

## Linear regression with random error giving EXACT predefined parameter estimates

January 26, 2016
By
$Linear regression with random error giving EXACT predefined parameter estimates$

When simulating linear models based on some defined slope/intercept and added gaussian noise, the parameter estimates vary after least-squares fitting. Here is some code I developed that does a double transform of these models as to obtain a fitted model with EXACT defined parameter estimates a (intercept) and b (slope). It does so by: 1)

## Introducing: Orthogonal Nonlinear Least-Squares Regression in R

January 17, 2015
By
$Introducing: Orthogonal Nonlinear Least-Squares Regression in R$

With this post I want to introduce my newly bred ‘onls’ package which conducts Orthogonal Nonlinear Least-Squares Regression (ONLS): http://cran.r-project.org/web/packages/onls/index.html. Orthogonal nonlinear least squares (ONLS) is a not so frequently applied and maybe overlooked regression technique that comes into question when one encounters an “error in variables” problem. While classical nonlinear least squares (NLS) aims

## Error propagation based on interval arithmetics

September 27, 2014
By
$Error propagation based on interval arithmetics$

I added an interval function to my ‘propagate’ package (now on CRAN) that conducts error propagation based on interval arithmetics. It calculates the uncertainty of a model by using interval arithmetics based on (what I call) a “combinatorial sequence grid evaluation” approach, thereby avoiding the classical dependency problem that often inflates the result interval. This

## I’ll take my NLS with weights, please…

January 13, 2014
By
$I’ll take my NLS with weights, please…$

Today I want to advocate weighted nonlinear regression. Why so? Minimum-variance estimation of the adjustable parameters in linear and non-linear least squares requires that the data be weighted inversely as their variances . Only then is the BLUE (Best Linear Unbiased Estimator) for linear regression and nonlinear regression with small errors (http://en.wikipedia.org/wiki/Weighted_least_squares#Weighted_least_squares), an important fact

## Introducing ‘propagate’

August 31, 2013
By
$Introducing ‘propagate’$

With this post, I want to introduce the new ‘propagate’ package on CRAN. It has one single purpose: propagation of uncertainties (“error propagation”). There is already one package on CRAN available for this task, named ‘metRology’ (http://cran.r-project.org/web/packages/metRology/index.html). ‘propagate’ has some additional functionality that some may find useful. The most important functions are: * propagate: A

## predictNLS (Part 2, Taylor approximation): confidence intervals for ‘nls’ models

August 26, 2013
By
$predictNLS (Part 2, Taylor approximation): confidence intervals for ‘nls’ models$

Initial Remark: Reload this page if formulas don’t display well! As promised, here is the second part on how to obtain confidence intervals for fitted values obtained from nonlinear regression via nls or nlsLM (package ‘minpack.lm’). I covered a Monte Carlo approach in http://rmazing.wordpress.com/2013/08/14/predictnls-part-1-monte-carlo-simulation-confidence-intervals-for-nls-models/, but here we will take a different approach: First- and second-order

## predictNLS (Part 1, Monte Carlo simulation): confidence intervals for ‘nls’ models

August 14, 2013
By
$predictNLS (Part 1, Monte Carlo simulation): confidence intervals for ‘nls’ models$

Those that do a lot of nonlinear fitting with the nls function may have noticed that predict.nls does not have a way to calculate a confidence interval for the fitted value. Using confint you can obtain the error of the fit parameters, but how about the error in fitted values? ?predict.nls says: “At present se.fit

## Trivial, but useful: sequences with defined mean/s.d.

July 31, 2013
By
$Trivial, but useful: sequences with defined mean/s.d.$

O.k., the following post may be (mathematically) trivial, but could be somewhat useful for people that do simulations/testing of statistical methods. Let’s say we want to test the dependence of p-values derived from a t-test to a) the ratio of means between two groups, b) the standard deviation or c) the sample size(s) of the

## wapply: A faster (but less functional) ‘rollapply’ for vector setups

April 23, 2013
By

For some cryptic reason I needed a function that calculates function values on sliding windows of a vector. Googling around soon brought me to ‘rollapply’, which when I tested it seems to be a very versatile function. However, I wanted to code my own version just for vector purposes in the hope that it may

## bigcor: Large correlation matrices in R

February 22, 2013
By
$bigcor: Large correlation matrices in R$

As I am working with large gene expression matrices (microarray data) in my job, it is sometimes important to look at the correlation in gene expression of different genes. It has been shown that by calculating the Pearson correlation between genes, one can identify (by high values, i.e. > 0.9) genes that share a common