Displaying 20 results from an estimated 60000 matches similar to: "How to Write a Model in R that has the Log taken of the Intercept"
2007 Aug 28
1
FW: How to fit an linear model withou intercept
Hi Mark,
I don't know wether you recived a sufficient reply or not, so here are
my comments to your problem.
Supressing the constant term in a regression model will probably lead to
a violation of the classical assumptions for this model.
From the OLS normal equations (in matrix notation)
(1) (X'X)b=X'y
and the definition of the OLS residuals
(2) e = y-Xb
you get - by
2002 Aug 30
4
Intercept in model formulae.
Hi,
I'm trying to create a linear model for a dataset that has a breakpoint e.g.
# dummy dataset
x <- 1:20
y <- c(1:10,seq(10.5,15,0.5))
plot(x,y)
I've modelled this using the following formula:
temp <- lm(y ~ x*(x<=10)+x*(x>10))
I want to be able to omit the intercept (i.e. force the line through
zero) from the first of these segments (x<=10) so that I'm only
2012 Jul 13
4
R-squared with Intercept set to 0 (zero) for linear regression in R is incorrect
Hi,
I have been using lm in R to do a linear regression and find the slope
coefficients and value for R-squared. The R-squared value reported by R
(R^2 = 0.9558) is very different than the R-squared value when I use the
same equation in Exce (R^2 = 0.328). I manually computed R-squared and the
Excel value is correct. I show my code for the determination of R^2 in R.
When I do not set 0 as the
2023 Feb 22
1
Problem of intercept?
Not sure what you are trying to do here.
The immediate issue is that you are getting 'y' on the RHS, because that is the 1st column in Dataset. So "for (i in 2:3)" might be closer to intention.
However, a 0/1 regresson with no intercept implies that the mean for the "0" group is zero, and with two regressors that the mean is zero for the (0,0) group. Looking at the
2009 Nov 08
2
negative log likelihood
I have two related variables, each with 16 points (x and Y). I am given
variance and the y-intercept. I know how to create a regression line and
find the residuals, but here is my problem. I have to make a loop that uses
the seq() function, so that it changes the slope value of the y=mx + B
equation ranging from 0-5 in increments of 0.01. The loop also needs to
calculate the negative log
2011 Oct 16
2
Suppressing the Intercept in lm() when using a dataframe for the model
It's easy to run a linear regression on a simple model without an intercept
just by doing this:
lm(y ~ x1 + x2 -1)
Is there a similar trick to suppress the intercept when your model is in a
large dataframe and you don't want to write out the names of individual
columns?
--
View this message in context:
2009 Mar 24
3
Display Equation on plot
Hello,
I am using the lm to fit a linear model to data, I was wondering if
there is a way to display the equation on a plot using the extracted lm
coefficients? I am using the plot() function to create the plot/.png.
Example:
lm_mod <- lm(data1~data2)
intercept = 48.54
slope = 0.4856
I want to display equation on a plot as y=0.4856x+48.54
Any thoughts or suggestions are appreciated.
2004 Jan 05
4
r: lm question
Hi all
this is a silly question since i should know the answer.
lm(y~x) perfroms linear regression with the intercept included.
How do i estimate the equation without the intercept?
cheers
2003 Nov 10
1
model constant relations
Dear list members,
this is not an R question and forgive me for using the list for irrelevant
questions, but this is the only place I know where I can find some good
statisticians and I need an expert opinion.
There is this power law kinetic model of the form:
M=kt^n
where t is the time, M is the fraction of drug released, k is the rate
constant and n is an exponent related to the mechanism of
2007 Jun 14
3
how to fit y=m*x
Hi There,
I have a set of data (xi,yi).I want to fit them with the equation
y=mx.
note: in the above equation, there is no intercept.
I don't know how to use common software such as R , matlab, sas, or
spss to do this kind of regression.
Does anyone know how to do this?
I know it is easy to use least square method to do this by
programming. But I want to find if there exists some common
2010 Apr 14
1
what is the intercept of a two-way anova model without interaction term?
Dear list,
I have a question regarding the meaning of intercept term in a two-way anova model without interaction term.
for example (let's assume there is no interaction between factor1 and factor2) :
> df
val factor1 factor2
1 48.61533 A t1
2 171.13535 B t1
3 65.96884 C t1
4 63.71222 A t2
5 80.22049 B t2
6
2012 Jun 30
2
Adjusting length of series
Hi
I have a follow up question, relating to subsetting to list items. After using the list and min(sapply()) method to adjust the length of the variables, I specify a dynamic regression equation using the variables in the list. My list looks like this:
Dcr<- list(Dcre1=DCred1,Dcre2=DCred2,Dcre3=DCred3,Dbobc1=DBoBC1,Dbobc2=DBoBC2,Dbobc3=DBoBC3,...)
By specifying the list items with names, I
2003 Jan 22
1
Intercept in model formulae
Hi,
I'm a new user of R and I'm trying to make a linear model from this kind of
dataset
x
[1] 16.87 19.93 25.85 20.94 17.06 19.49 19.93 25.45 27.74 20.15 25.81
21.06 17.17 20.03 25.50 27.79 20.44 16.88 19.93 25.79
z<-x-10
y
[1] 0.80 1.27 2.22 1.32 0.90 1.18 1.84 2.41 2.97 1.25 2.07 1.41 1.14 1.66
2.59 3.51 1.53 0.81 1.26 2.30
plot(x,y)
I want to be able to force the line of
2011 Nov 12
1
State space model
Hi,
I'm trying to estimate the parameters of a state space model of the
following form
measurement eq:
z_t = a + b*y_t + eps_t
transition eq
y_t+h = (I -exp(-hL))theta + exp(-hL)y_t+ eta_{t+h}.
The problem is that the distribution of the innovations of the transition
equation depend on the previous value of the state variable.
To be exact: y_t|y_{t-1} ~N(mu, Q_t) where Q is a diagonal
2012 Mar 20
2
Constraint Linear regression
Hi there,
I am trying to use linear regression to solve the following equation -
y <- c(0.2525, 0.3448, 0.2358, 0.3696, 0.2708, 0.1667, 0.2941, 0.2333,
0.1500, 0.3077, 0.3462, 0.1667, 0.2500, 0.3214, 0.1364)
x2 <- c(0.368, 0.537, 0.379, 0.472, 0.401, 0.361, 0.644, 0.444, 0.440,
0.676, 0.679, 0.622, 0.450, 0.379, 0.620)
x1 <- 1-x2
# equation
lmFit <- lm(y ~ x1 + x2)
lmFit
Call:
2005 Jun 30
2
Linear Models with mean as Intercept.
Dear advanced statisticians,
*******Objectif********
I try to set up linear models with mean as intercept:
Answer: y
Variable: x, as factor of two modalities: x(1), x(2).
I would like to have a model as:
y = mean(y)+A(i)+residuals,
with i in (1,2) and A(1) coefficient for x(1) and A(2) coefficient for x(2).
*******Trials in R*******
## Firstly:
I write in R:
>Model<-lm(y~x,Data)
2012 Nov 13
1
About systemfit package
Dear friends,
I have written the following lines in R console wich already exist in pdf
file systemfit:
data( "GrunfeldGreene" )
library( "plm" )
GGPanel <- plm.data( GrunfeldGreene, c( "firm", "year" ) )
greeneSur <- systemfit( invest ~ value + capital, method = "SUR",
+ data = GGPanel )
greenSur
I have obtained the following incomplete
2009 Jan 13
5
Trouble about the interpretation of intercept in lm models
Hallo,
yesterday I was puzzled when I discovered that I
probabliy miss something in the interepretation of intercept
in two-way lm models.
I thought that the intercept, using the default contr.treatment
contrasts, represents the mean of the group of observations
having zero in all column of the model.matrix.
It turns out not to be case
To be more more clear I am attaching a short example:
2007 May 21
4
How to compare linear models with intercept and those without intercept using minimizing adjs R^2 strategy
Dear R-list,
I apologize for my many emails but I think I know how to desctribe my
problem differently and more clearly.
My question is how to compare linear models with intercept and those without
intercept using maximizing adjusted R^2 strategy.
Now I do it like the following:
> library(leaps)
> n=20
> x=matrix(rnorm(n*3),ncol=3)
> b=c(1,2,0)
> intercept=1
>
2007 Feb 09
2
LM Model
Dear R-Users,
How can I put a pre-defined regression model into to an object of class lm
in order to use the predict.lm function.
A simplified example:
I would normally run a regression analysis on a dataset,
> germany<-lm(RENT~AGE1, in.mi01)
> summary(germany)
Call:
lm(formula = RENT ~ AGE1, data = in.mi01)
Residuals:
Min 1Q Median 3Q Max