Displaying 20 results from an estimated 200 matches similar to: "analysis of covariance and constrained parameters"
2007 Nov 02
3
writing a categorical var. with condition
Hello,
I want to create a new variable which includes 4 age categories in this way:
if (age>=12 && age<32) age1==1
if (age>=32 && age<52) age1==2
if (age>=52 && age<72) age1==3
if (age>=72 && age<100) age1==4
but I get the results only for the first observation.
how can I apply this condition to all observations?
Thanks in advance,
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
2008 Jan 15
2
Looking for simpler solution to probabilistic question
Hi
I have two processes which take with a certain probability (p1 and p2) x
number of years to complete (age1 and age2). As soon as thge first
process is completed, the second one begins. I want to calculate the
time it takes for the both processes to be completed.
I have the following script which gives me the answer, butI think there
must be a more elegant way of doing the calculations
2002 Nov 26
1
Reshape by multiple variables
Dear list
I'm using the reshape command and want to reshape a wide data set to a
long one
e.g. I have the variables y1,y2,y3,age1,age2,age3,sex,ethnic
I want my new long data set to consist of the variables y (which has
been created from y1,y2,y3), age (which has been created from
age1,age2,age3), sex and ethnic
I have tried to use the command:
2008 May 12
1
Standard error of combination of parameter estimates
Hi,
Is there a simple command for computing the standard error of a
combination of parameter estimates in a GLM?
For example:
riskdata$age1 <- riskdata$age
riskdata$age2 <- ifelse(riskdata$age<67,0,riskdata$age-67)
model <- glm(death~age1+age2+ldl,
data=riskdata,family=binomial(link=logit))
And we want to find the standard error of the partial linear predictor
for
2009 Sep 21
2
cox memory
Hi there,
I have a rather large data set and perform the following cox model:
test1 <- list(tstart,tstop,death1,chemo1,radio1,horm1)
out1<-coxph( Surv(tstart,tstop, death1) ~ chemo1+chemo1:log(tstop+1)+horm1+horm1:log(tstop+1)+age1+grade1+grade1:log(tstop+1)+positive1+positive1:log(tstop+1)+size1+size1:log(tstop+1), test1)
out1
Up to here everything works fine (with each covariate
2007 Feb 09
1
subset function
Hello R-Users,
I have the following problem with the subset function:
See the following simple linear model. Here everything works fine:
>germany<-lm(RENT~AGE1, in.mi01)
However, if a use the same regression equation and only specify a subset, I
get an error message:
> berlin<-lm(RENT~AGE1, in.mi01, subset=C_X01=="Berlin")
Error in lm.fit(x, y, offset
2011 Oct 05
1
calling a variable which in turn calls many more variables
Hi all,
I am running regressions with many covariates, most of which remain the same
each time (control variables). Instead of writing 30 demographic variables
every regression, is there a way I could call them all at once using a
variable called, perhaps "demog"?
I have tried:
> demog <- list(age1, age2, age3) but I get an error when I try to call a
list in a regression.
I also
2008 Nov 06
3
unlist & dataframes
Dear all,
I would like to know whether it is possible to unlist elements and keep the
original format of the data.
To make it more clear, let me give an exemple:
I have a list l of dataframes that I created with apply but which looks like
this:
x1=data.frame(Name=LETTERS[1:2],Age=1:2)
x2=data.frame(Name=LETTERS[3:4],Age=3:4)
l=list(x1,x2)
l
[[1]]
Name Age
1 A 1
2 B 2
[[2]]
Name
2005 Aug 12
2
coercing created variables into a new data frame using na.omit()
Hi,
I am an R newbie and one thing I am having trouble with binding variables that
I have created within one data frame into a new data frame when using
na.omit(). To illustrate this problem I will give the example I am working on
and the approah I have been using:-
data.frame1<-filepath....
attach(data.frame1)
#create a new variable using a function
new.variable<-rep(1,length(weight3))
2008 Jun 05
1
quite complicated case(the repeated data arranage~)
Hi everyone:
I have been struggling with this repeated data type for whole afternoon,I
sent two emails to server for help,many people kindly responded , hereby
thank you so much,but since I dont want to write to much in email,so I
divide the problem in parts,so far this seem did not work out very well,so
this is my whole problem~
first I have example of data here:
2008 Aug 21
1
Interpreting Logistic Regression
Hi !
This is Madhavi from Mumbai, India. Incidently this is my first post.
I am working on Credit Scoring Model and using R, I have run the logistic regression. I have received following Output.
I have two questions
(a) What is the significance of "family = binomial(link = logit)". Why do I have to mention Binomial? Is it because my dependent variable assumes only two values 0 and 1?
2007 Mar 05
1
Matrix/dataframe indexing
Hi all,
I am hoping someone can help me out with this:
If I have dataframe of years and ages and the first column and first row
are filled with leading values:
Df<- age1 age2 age3
Yr1 1 0.4 0.16
Yr2 1.5 0 0
Yr3 0.9 0 0
Yr4 1 0 0
Yr5 1.2 0 0
Yr6 1.4 0 0
Yr7 0.8 0 0
Yr8 0.6 0 0
Yr9 1.1 0 0
Now the rest of the cells need to be filled according to the previous
year and age
2012 Jul 31
1
Mediation analysis
Hello all,
I apologize for the simplistic question, but I have been having some trouble
learning how to do mediation analysis in R. Ideally, I would like to use
Preacher's Bootstrapping test for mediation (Preacher & Hayes, 2004). I have
attempted to use the mediate package to set this up, using code that looks
basically like this:
model.m <- lm(data$outcome ~ data$mediator +
2007 May 05
1
importing data
Hello,
I need to import a data set.
I have never imported data files with R. I have always worked on simulated data.
I have looked at R Data Import/Export manual.
It is a bit peculiar because my data base is already an R object called "japan".
I guess it is not yet a data set, and I don't know how to manipulate variables from it.
When I type "japan", here is an extract
2008 Aug 20
1
Understanding output of summary(glm(...))
Simple example of 5 groups of 4 replicates.
>set.seed(5)
>tmp <- rnorm(20)
>gp <- as.factor(rep(1:5,each=4))
>summary(glm(tmp ~ -1 + gp, data=data.frame(tmp, gp)))$coefficients Estimate Std. Error t value Pr(>|t|)gp1 -0.1604613084 0.4899868 -0.3274809061 0.7478301gp2 0.0002487984 0.4899868 0.0005077655 0.9996016gp3 0.0695463698 0.4899868
2003 Dec 17
5
beginner programming question
Hi all,
The last e-mails about beginners gave me the courage to post a question;
from a beginner's perspective, there are a lot of questions that I'm
tempted to ask. But I'm trying to find the answers either in the
documentation, either in the about 15 free books I have, either in the
help archives (I often found many similar questions posted in the past).
Being an (still actual)
2013 Sep 01
0
Question About Markov Models
Dear All,
I am a bit struggling with the many packages for Markov models available
in R.
Apologies for now posting a code snippet, but I am looking for some
guidance here.
Please consider a set like the one below (which you can get with
data<-read.csv('http://dl.dropboxusercontent.com/u/5685598/data_table.csv')
).
ID therapy age1 age2 EFS
7308 ormo_lunga 78
2009 Dec 15
1
error when using multcomp and lm
I am trying to use multcomp to do a Tukey posthoc on growth increments among
genetic crosstypes.
#Fixed effect model
m1 <- lm(inc ~ 0 + Age+ Crosstype + Sex, data = Data.age)
summary(m1)
RESULTS of the model:
summary(m1)
Call:
lm(formula = inc ~ 0 + Age + Crosstype + Sex, data = Data.age)
Residuals:
Min 1Q Median 3Q Max
-0.87180 -0.34002 -0.02702 0.27710 2.17820
2010 Feb 11
1
Rounding multinomial proportions
I present you with a function that solves a problem that has bugged me for
many years. I think the problem may be general enough to at least consider
adding this function, or a revamped version of it, to the 'stats' package,
with the other multinomial functions reside.
I'm using R to export data to text files, which are input data for an
external model written in C++. Parts of the