[R] Inconsistent linear model calculations

Douglas Bates bates at stat.wisc.edu
Thu May 15 15:39:56 CEST 2008


Did you happen to notice the part at the bottom of every message about
"provide commented, minimal, self-contained, reproducible code"?

Considering that the result you quote from "251" has 2 coefficients
and the result from "171" has 3 coefficients one might contemplate the
possibility that you are fitting different models or perhaps using
different data.  However we can't verify anything about the causes
because we have no data regarding the problem.

Perhaps you are Brian Ripley's evil twin trying to provoke him.  I
would say that references to a nonexistent version "171" are
deliberately provocative.  ("251" could be considered a lazy person's
attempt at 2.5.1 but "171" which presumably came after "251" doesn't
make any sense to me.)

On Thu, May 15, 2008 at 7:05 AM, e-letter <inpost at gmail.com> wrote:
> Readers,
>
> Using version 251 I tried the following command:
>
> lm(y~a+b,data=datafile)
>
> Resulting in, inter alia:
> ...
> coefficients
> (intercept) a
> 1.2 3.4
>
> Packages installed:
> acepack                 ace() and avas() for selecting regression
>                        transformations
> adlift                  An adaptive lifting scheme algorithm
> akima                   Interpolation of irregularly spaced data
> alr3                    Methods and data to accompany Applied Linear
>                        Regression 3rd edition
> car                     Companion to Applied Regression
> coda                    Output analysis and diagnostics for MCMC
> drc                     Analysis of dose-response curves
> EbayesThresh            Empirical Bayes thresholding and related
>                        methods
> emplik                  Empirical likelihood ratio for
>                        censored/truncated data
> gllm                    Generalised log-linear model
> glmc                    Fitting Generalized Linear Models Subject to
>                        Constraints
> glmmML                  Generalized linear models with clustering
> glmpath                 L1 Regularization Path for Generalized Linear
>                        Models and Cox Proportional Hazards Model
> HydroMe                 Estimation of Soil Hydraulic Parameters from
>                        Experimental Data
> JGR                     JGR - Java Gui for R
> lmtest                  Testing Linear Regression Models
> locfit                  Local Regression, Likelihood and Density
>                        Estimation.
> mvtnorm                 Multivariate Normal and t Distributions
> NISTnls                 Nonlinear least squares examples from NIST
> nlme                    Linear and Nonlinear Mixed Effects Models
> nlstools                Tools for nonlinear regression diagnostics
> nlt                     A nondecimated lifting transform for signal
>                        denoising
> nlts                    (non)linear time series analysis
> nnls                    The Lawson-Hanson algorithm for non-negative
>                        least squares (NNLS)
> plotrix                 Various plotting functions
> quantreg                Quantile Regression
> Rcmdr                   ** No title available (pre-2.0.0 install?) **
> sandwich                Robust Covariance Matrix Estimators
> SparseM                 Sparse Linear Algebra
> sspline                 Smoothing Splines on the Sphere
> zoo                     Z's ordered observations
>
> Packages in library '/usr/lib/R/library':
> base                    The R Base Package
> boot                    Bootstrap R (S-Plus) Functions (Canty)
> class                   Functions for Classification
> cluster                 Cluster Analysis Extended Rousseeuw et al.
> codetools               Code Analysis Tools for R
> datasets                The R Datasets Package
> foreign                 Read Data Stored by Minitab, S, SAS, SPSS,
>                        Stata, Systat, dBase, ...
> graphics                The R Graphics Package
> grDevices               The R Graphics Devices and Support for Colours
>                        and Fonts
> grid                    The Grid Graphics Package
> KernSmooth              Functions for kernel smoothing for Wand & Jones
>                        (1995)
> lattice                 Lattice Graphics
> MASS                    Main Package of Venables and Ripley's MASS
> methods                 Formal Methods and Classes
> mgcv                    GAMs with GCV smoothness estimation and GAMMs
>                        by REML/PQL
> nlme                    Linear and Nonlinear Mixed Effects Models
> nnet                    Feed-forward Neural Networks and Multinomial
>                        Log-Linear Models
> quadprog                Functions to solve Quadratic Programming
> lattice                 Lattice Graphics
> MASS                    Main Package of Venables and Ripley's MASS
> methods                 Formal Methods and Classes
> mgcv                    GAMs with GCV smoothness estimation and GAMMs
>                        by REML/PQL
> nlme                    Linear and Nonlinear Mixed Effects Models
> nnet                    Feed-forward Neural Networks and Multinomial
>                        Log-Linear Models
> quadprog                Functions to solve Quadratic Programming
>                        Problems.
> rcompgen                Completion generator for R
> rpart                   Recursive Partitioning
> spatial                 Functions for Kriging and Point Pattern
>                        Analysis
> splines                 Regression Spline Functions and Classes
> stats                   The R Stats Package
> stats4                  Statistical Functions using S4 Classes
> survival                Survival analysis, including penalised
>                        likelihood.
> tcltk                   Tcl/Tk Interface
> tools                   Tools for Package Development
> utils                   The R Utils Package
>
> When using version 171 I entered the same command:
>
> lm(y~a+b,data=datafile)
>
> Resulting in, inter alia:
> ...
> coefficients
> (intercept) a b
> 5.6 7.8 9.01
>
> Packages installed:
> base                    The R base package
> boot                    Bootstrap R (S-Plus) Functions (Canty)
> class                   Functions for classification
> cluster                 Functions for clustering (by Rousseeuw et al.)
> ctest                   Classical Tests
> eda                     Exploratory Data Analysis
> foreign                 Read data stored by Minitab, S, SAS, SPSS,
>                        Stata, ...
> grid                    The Grid Graphics Package
> KernSmooth              Functions for kernel smoothing for Wand &
>                        Jones (1995)
> lattice                 Lattice Graphics
> lqs                     Resistant Regression and Covariance Estimation
> MASS                    Main Library of Venables and Ripley's MASS
> methods                 Formal Methods and Classes
> mgcv                    Multiple smoothing parameter estimation and
>                        GAMs by GCV
> modreg                  Modern Regression: Smoothing and Local Methods
> mva                     Classical Multivariate Analysis
> nlme                    Linear and nonlinear mixed effects models
> nls                     Nonlinear regression
>
> lqs                     Resistant Regression and Covariance Estimation
> MASS                    Main Library of Venables and Ripley's MASS
> methods                 Formal Methods and Classes
> mgcv                    Multiple smoothing parameter estimation and
>                        GAMs by GCV
> modreg                  Modern Regression: Smoothing and Local Methods
> mva                     Classical Multivariate Analysis
> nlme                    Linear and nonlinear mixed effects models
> nls                     Nonlinear regression
> nnet                    Feed-forward neural networks and multinomial
>                        log-linear models
> rpart                   Recursive partitioning
> spatial                 functions for kriging and point pattern
>                        analysis
> splines                 Regression Spline Functions and Classes
> stepfun                 Step Functions, including Empirical
>                        Distributions
> survival                Survival analysis, including penalised
>                        likelihood.
> tcltk                   Tcl/Tk Interface
> tools                   Tools for package development
> ts                      Time series functions
>
> Why do I get different results when entering the same equation
> command? The correct answer was obtained using the older version of
> the software, so I want to replicate using the new version, which is
> installed onto a new pc that I am using. Any advice.
>
> Yours,
>
> rhelp at conference.jabber.org
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list