Displaying 20 results from an estimated 5000 matches similar to: "Intercept in model formulae."
2010 Mar 04
4
Analogue to SPSS regression commands ENTER and REMOVE in R?
I am not sure if this question has been asked before - but is there a
procedure in R (in lm or glm?) that is equivalent to ENTER and REMOVE
regression commands in SPSS?
Thanks a lot!
--
Dimitri Liakhovitski
Ninah.com
Dimitri.Liakhovitski at ninah.com
2004 Mar 29
2
Confidence Intervals for slopes
Hi,
I'm trying to get confidence intervals to slopes from a linear model
and I can't figure out how to get at them. As a cut 'n' paste example:
#################
# dummy dataset - regression data for 3 treatments, each treatment with
different (normal) variance
x <- rep(1:10, length=30)
y <- 10 - (rep(c(0.2,0.5,0.8), each=10)*x)+c(rnorm(10, sd=0.1),
rnorm(10,
2024 Jul 26
1
Automatic Knot selection in Piecewise linear splines
dear all,
I apologize for my delay in replying you. Here my contribution, maybe
just for completeness:
Similar to "earth", "segmented" also fits piecewise linear relationships
with the number of breakpoints being selected by the AIC or BIC
(recommended).
#code (example and code from Martin Maechler previous email)
library(segmented)
o<-selgmented(y, ~x, Kmax=20,
2002 May 28
1
passing model objects to anova()
Hi,
I'm fitting a glm to a dataset...
> objects()
[1] "pop.div.full" "speciation.data"
...and then performing model simplification to give a series of model
objects all of which have a common suffix.
> objects()
[1] "pop.div.full" "pop.div.gp.f.b.hm"
[3] "pop.div.gp.fb.hm"
2010 Dec 16
1
predict.lm with new regressor names
Hi all,
Suppose:
y<-rnorm(100)
x1<-rnorm(100)
lm.yx<-lm(y~x1)
To predict from a new data source, one can use:
# works as expected
dum<-data.frame(x1=rnorm(200))
predict(lm.yx, newdata=dum)
Suppose lm.yx has been run and we have the lm object. And we have a
dataframe that has columns that don't correspond by name to the
original regressors. I very! naively assumed that doing
2024 Jul 16
2
Automatic Knot selection in Piecewise linear splines
>>>>> Anupam Tyagi
>>>>> on Tue, 9 Jul 2024 16:16:43 +0530 writes:
> How can I do automatic knot selection while fitting piecewise linear
> splines to two variables x and y? Which package to use to do it simply? I
> also want to visualize the splines (and the scatter plot) with a graph.
> Anupam
NB: linear splines, i.e. piecewise
2009 Mar 07
2
piecewise linear regression
Hi - I'd like to construct and plot the percents by year in a small data set
(d) that has values between 1988 and 2007. I'd like to have a breakpoint
(buy no discontinuity) at 1996. Is there a better way to do this than in
the code below?
> d
year percent se
1 1988 30.6 0.32
2 1989 31.5 0.31
3 1990 30.9 0.30
4 1991 30.6 0.28
5 1992 29.3 0.25
6 1994 30.3
2012 Mar 01
2
Help with segmented package
Hi everyone.
I'm using segmented package to find break point in a bi-linear relationship.
In a particular case, I find 1 pointcut (so 2 slopes).
I would like to know if it is possible to retrieve information in the
segmented object that could let me to plot 1 particular segment with a
different color.
For example, in that folowing example, I would like to plot the second
segment in red.
2010 Jan 17
3
enty-wise closest element
Dear R-users,
i have a simple problem maybe, but i don't see the solution. i want to
find the entry-wise closest element of an vector compared with another.
ind1<-c(1,4,10)
ind2<-c(3,5,11)
for (i in length(ind2):1)
{
print(which.min(abs(ind1-ind2[i])))
}
for ind2[3] it should be ind1[3] 10, for ind2[2] it should be ind1[2] 4
and for ind2[1] it should be ind1[1] 1. but with the
2007 Nov 28
2
fit linear regression with multiple predictor and constrained intercept
Hi group,
I have this type of data
x(predictor), y(response), factor (grouping x into many groups, with 6-20
obs/group)
I want to fit a linear regression with one common intercept. 'factor'
should only modify the slopes, not the intercept. The intercept is expected
to be >0.
If I use
y~ x + factor, I get a different intercept for each factor level, but one
slope only
if I use
y~ x *
2006 Oct 30
1
Random intercept-slope correlation (nlme)
Dear list members,
I am working with a multilevel growth curve, that in its simplest form goes
like follows:
Yit = Ai + Bi t + eit (the error term is assumed to follow an AR(1)
autorregressive process)
One major topic in my research is the convergence in the values of Y over
time. Thus, I am interested in the relationship between the random effects
for the intercept and the slope, and I
2011 Mar 10
2
within group sequential subtraction
Hi Everyone,
I would like to do sequential subtractions within a group so that I know the
time between separate observations for a group of individuals.
My data:
data <- structure(list(group = c("IND1", "IND1", "IND2",
"IND2", "IND2", "IND3", "IND4", "IND5",
"IND6", "IND6"), date_obs =
2011 Mar 31
2
ANCOVA for linear regressions without intercept
Hello R experts
I have two linear regressions for sexes (Male, Female, Unknown). All have a good correlation between body length (response variable) and head length (explanatory variable). I know it is not recommended, but for a good practical reason (the purpose of study is to find a single conversion factor from head length to body length), the regressions need to go through the origin (0
2009 Sep 11
2
Accumulating results from "for" loop in a list/array
Dear R users,
I would like to accumulate objects generated from 'for' loop to a list or
array.
To illustrate the problem, arbitrary data set and script is shown below,
x <- data.frame(a = c(rep("n",3),rep("y",2),rep("n",3),rep("y",2)), b =
c(rep("y",2),rep("n",4),rep("y",3),"n"), c =
2011 Mar 09
2
Cleaning date columns
Hi Everyone,
I have the following problem:
data <- structure(list(prochi = c("IND1", "IND1", "IND1",
"IND2", "IND2", "IND2", "IND2", "IND3",
"IND4", "IND5"), date_admission = structure(c(6468,
6470, 7063, 9981, 9983, 14186, 14372, 5129, 9767, 11168), class = "Date")),
.Names =
2009 Apr 01
3
How to prevent inclusion of intercept in lme with interaction
Dear friends of lme,
After so many year with lme, I feel ashamed that I cannot get this to work.
Maybe it's a syntax problem, but possibly a lack of understanding.
We have growth curves of new dental bone that can well be modeled by a
linear growth curve, for two different treatments and several subjects as
random parameter. By definition, newbone is zero at t=0, so I tried to force
the
2010 May 03
3
how to rewrite this for loops in matrix form without loop
x0=rnorm(100)
y0=rpois(100,3)+1
ind=as.data.frame(table(y0))
ind1=ind[,1]
ind2=ind[,2]
phi=NULL
for (i in 1:length(ind2)){
phi[i]=sum(x0[y0==ind1[i]])/ind2[i]
}
[[alternative HTML version deleted]]
2011 Dec 04
2
frequency table?
Hello R-users,
I've got a file with individuals as colums and the clusters where they occur
in as rows. And I wanted a table which tells me how many times each
individual occurs with another. I don't really know how such a table is
called...it is not a frequency table....My eventual goal is to make
Venn-diagrams from the occurence of my individuals.
So I've this:
cluster ind1 ind2
2008 Jun 02
1
Ancova: formula with a common intercept
I have some data with two categorises plus/minus (p53) and a particular
time (Time) and the outcome is a continuous vairable (Result). I set up
a maximum model.
ancova <- lm(Result~Time*p53)
> summary(ancova)
..
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.05919 0.55646 0.106 0.916
Time -0.02134 0.01785 -1.195 0.241
p53plus
2005 Apr 25
6
Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1))) ?
Dear all,
First I apologize if my question is quite simple,
but i'm very newbie with R.
I have vectors of the form v = c(1,1,-1,-1,-1,1,1,1,1,-1,1)
(longer than this one of course).
The elements are only +1 or -1.
I would like to calculate :
- the frequencies of -1 occurences after 2 consecutives -1
- the frequencies of +1 occurences after 2 consecutives +1
It looks probably something like