# Tagged Questions

lm is the name of the linear model (i.e. multiple regression) function in the statistics package R. For linear models in general use the linear-model tag instead.

16 views

### Strange intercept using lmp() in lmPerm library in R

Please consider this data set: y <- c(2, 4, 6) x <- c(1, 2, 3) Now calculate a linear model using lmp(): ...
67 views

### How do I get the amplitude and phase for sine wave from lm() summary?

A simple sine curve could be written as $\text{amplitude}\cdot\sin(x+\text{phase})$. It can be also written in linear form as $a \cdot \sin(x) + b \cdot \cos(x)$. I run my analysis with R as: ...
9 views

### Estimability and less than full rank model matrices

So I have some data... ...
53 views

### R- Analysis of homogeneity of slopes

I´d like to analyse the effect of a treatment (treatment : Factor w/ 2 levels "ambient","elevated") in tree diameter increment. Tree diameter is influenced by ...
89 views

### Recalculate log-likelihood from a simple R lm model

I'm simply trying to recalculate with dnorm() the log-likelihood provided by the logLik function from a lm model (in R). It works (almost perfectly) for high number of data (eg n=1000) : ...
68 views

### Centering when using splines in R

I am having trouble understanding why centering seems to only work with simple linear models and not with splines for example. I am using centering to report the estimated group differences at ...
109 views

### Error with lm, common R mistake

I'm taking a class on R and I cannot get the professors code to work. I am trying to do a simple linear model and I run this code: ...
44 views

### predict(lm) with two interactions possible or incorrect?

in order to understand the output of one of my lme models I produced a little simpler example using lm (so no random factor). I noticed that my fitted model does not seem to fit the data correctly, as ...
65 views

### Best way to specify a mixed ANCOVA in R?

After using ezANOVA as my primary way of specifying mixed ANOVAs, I've hit a stumbling block when it come to adding a covariate to the model. I am using an ANCOVA ...
42 views

### Are random effects justified if there is no variability between groups?

I'm looking for more of a substantive ( but also a statistical ) answer. If in the empty model (just intercept) there is no variability at level-2, should HLM still be applied just because the data is ...
101 views

### How to interpret output of CVlm() in R?

I am using 10 fold cross validation using the CVlm() function from the DAAG package. This is part of the result shown: ...
145 views

### How to translate the results from lm() to an equation?

We can use lm() to predict a value, but we still need the equation of the result formula in some cases. For example, add the equation to plots.
107 views

### does rstandard standardize in z?

I'm new to R, so please be gentle. I was under the impression that rstandard(model) returns the z-scores of the residuals in ...
108 views

### Order of variables in R lm model

Is the order of variables in an R model supposed to be significant? For some reason, the two models below result in different coefficients associated with fm and yr (which are supposed to model fixed ...
799 views

### How to find a good fit for semi-sinusoidal model in R?

I want to assume that the sea surface temperature of the Baltic Sea is the same year after year, and then describe that with a function / linear model. The idea I had was to just input year as a ...
75 views

### Basic questions concerning the interpretation of results from summary(lm(…~…)) in R [duplicate]

set.seed(11) a = runif (12) b = rep(c(1,2,3),4) summary(lm(a~b))$coeff summary(lm(a~b-1))$coeff What does a p.value for the intercept means ? What differences ...
65 views

### Is this an error or not?

I am trying to fit a second order polynomial. I center and scale my predictors and fit the data using the lm function. I did ...
708 views

### Standardized residuals in R's lm output

I have a quick question: if I plot the diagnostic plots to an R regression, a couple of them have "Standardized Residuals" as their y-axis such as in this plot: My question is this: what are the ...
234 views

### How does one define own intercept in regression model in R?

My case is that I have one continuous DV variable and two categorical IVs containing 11 and 12 different levels (YEAR & MONTH) form 1998 to 2008. Until now I have experimented a lot with ...
61 views

### Explanation of a step in derivation of residuals for R lm diagnostic?

I'm reading Faraway's book (http://cran.r-project.org/doc/contrib/Faraway-PRA.pdf) to try to understand R's lm diagnostic plots. On page 72 of the book is this: I have been trying to understand a ...
116 views

### Curvature terms and model selection

I am running a model selection analysis with a continuous dependent variable and a variety of continuous and categorical explanatory variables. For two of my continuous explanatory variables I am ...
117 views

### Weighting the response variable in an lm

I want to do a simple lm of y~x where I weight my response variable. This is because the values of y are actually each in turn the value of a slope of another regression of y~year i.e. rates of ...
495 views

### Calculate F-statistic / p-value for subset of co-efficients in R

I'm wondering if there's an easy way of calculating an F-statistic / p-value for a subset of model coefficients. Particularly in R? I'm not sure what test would be needed to calculate this. For ...
2k views

### R: Calculating mean and standard error of mean for factors with lm() vs. direct calculation -edited

When dealing with data with factors R can be used to calculate the means for each group with the lm() function. This also gives the standard errors for the estimated means. But this standard error ...
270 views

### R lm simultaneous parameter tests

Using R, I'd like to test whether multiple parameters in a regression model are equal to specific values (by default, are multiple parameters equal to 0). For example, in this regression model: ...
369 views

### How does anova.lm in R calculates “Sum Sq”?

I'm learning R and trying to understand how lm() handles factor variables & how to make sense of the ANOVA table. I'm fairly new to statistics, so please be ...
1k views

### What is the adjusted R-squared formula in lm in R and how should it be interpreted?

What is the exact formula used in R lm() for the Adjusted R-squared? How can I interpret it? Adjusted r-squared formulas There seem to exist several formula's to calculate Adjusted R-squared. ...
274 views

### lm() - model specification

If have multivariate data of 3 response variables and 2 factors (f1 and f2). I can specify an linear model in different ways for this data, however I don't know what the difference between the models ...
111 views

### lm regression in R - inconsistent R² for intercept-free model?

I am carrying a linear regression on some data. One of my variables is a factor (categorical). Using regression with an intercept leads to difficult interpretation, since one of the factor levels is ...
324 views

### Can dredge() in R package MuMIn deal with global model objects generated by gls() in nlme?

I am trying to use the function dredge() in the package MuMIn to compare AIC model-selection statistics for models of all ...
115 views

### Unable to figure out right transformation

I have obtained some data about how complexity of Java open source projects varies with time. I want to fit a curve to the data, however I am unable to figure out the right kind of transformation. I ...
5k views

### How are the standard errors of coefficients calculated in a regression?

For my own understanding, I am interested in manually replicating the calculation of the standard errors of estimated coefficients as, for example, come with the output of the ...
302 views

### Simple introduction to linear models in R

It was hard for me to understand linear models in R. There are a lot of documents for the case, but many of them are technical manuals rather than teaching the concept. I found this article really ...
2k views

### Does lm() use partial correlation - R Squared Change?

I come from an SPSS background and am attempting to move to R for it's superior flexibility and data manipulation abilities. I have some concerns however as to ...
658 views

### Non-parametric alternative to linear regressions in R

I want to run series of simple lm in R, with a continuous/categorical outcome and binary group membership (patients - controls) and categorical predictors. However the categorical predictor is ...
60 views

### Linear model overfit due to too many covariates? [duplicate]

Possible Duplicate: Linear model overfitting due to too many covariates My study design involves a control and 2 test groups plus some covariates. Each group consists of around 20 ...