Posts Tagged ‘ lm ’

Why pictures are so important when modeling data?

October 31, 2012
By
Why pictures are so important when modeling data?

(bis repetita) Consider the following regression summary,Call: lm(formula = y1 ~ x1)   Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.0001 1.1247 2.667 0.02573 * x1 0.5001 0.1179 4.241 0.00217 **...

Read more »

Visualization in regression analysis

February 23, 2012
By
Visualization in regression analysis

Visualization is a key to success in regression analysis. This is one of the (many) reasons I am also suspicious when I read an article with a quantitative (econometric) analysis without any graph. Consider for instance the following dataset, obtai...

Read more »

On linear models with no constant and R2

February 2, 2012
By
On linear models with no constant and R2

In econometrics course we always say to our students that "if you fit a linear model with no constant, then you might have trouble. For instance, you might have a negative R-squared". So I tried to find databases on the internet such that, when we ...

Read more »

Linear regression models with robust parameter estimation

May 15, 2010
By

There are situations in regression modelling where robust methods could be considered to handle unusual observations that do not follow the general trend of the data set. There are various packages in R that provide robust statistical methods which are summarised on the CRAN Robust Task View. As an example of using robust statistical estimation in

Read more »

Manual variable selection using the dropterm function

May 12, 2010
By
Manual variable selection using the dropterm function

When fitting a multiple linear regression model to data a natural question is whether a model can be simplified by excluding variables from the model. There are automatic procedures for undertaking these tests but some people prefer to follow a more manual approach to variable selection rather than pressing a button and taking what comes

Read more »

Using the update function during variable selection

May 9, 2010
By

When fitting statistical models to data where there are multiple variables we are often interested in adding or removing terms from our model and in cases where there are a large number of terms it can be quicker to use the update function to start with a formula from a model that we have already

Read more »

Analysis of Covariance – Extending Simple Linear Regression

April 28, 2010
By
Analysis of Covariance – Extending Simple Linear Regression

The simple linear regression model considers the relationship between two variables and in many cases more information will be available that can be used to extend the model. For example, there might be a categorical variable (sometimes known as a covariate) that can be used to divide the data set to fit a separate linear

Read more »

Simple Linear Regression

April 23, 2010
By
Simple Linear Regression

One of the most frequent used techniques in statistics is linear regression where we investigate the potential relationship between a variable of interest (often called the response variable but there are many other names in use) and a set of one of more variables (known as the independent variables or some other term). Unsurprisingly there

Read more »

In a nls star things might be different than the lm planet…

March 10, 2010
By

The nls() function has a well documented (and discussed) different behavior compared to the lm()’s. Specifically you can’t just put an indexed column from a data frame as an input or output of the model. > nls(data ~ c + expFct(data,beta), data = time.data, + start = start.list) Error in parse(text = x) : unexpected

Read more »

One-way ANOVA (cont.)

February 12, 2010
By
One-way ANOVA (cont.)

In a previous post we considered using R to fit one-way ANOVA models to data. In this post we consider a few additional ways that we can look at the analysis. In the analysis we made use of the linear model function lm and the analysis could be conducted using the aov function. The code used

Read more »