Skip to content

how to put constraint in R?

2 messages · Oana Mocila, Spencer Graves

#
Dear all,

I have a problem when I was working on Age-Period-Cohort study in R. I tried 
to put constraint to
two coefficients on age (so that to solve the identification problem due to 
linear dependency). But
I don't know how to do this in R(put constraint). If you could give me some 
suggestion, it will be very helpful!

Oana
1 day later
#
What are you trying to do?

	  Suppose, for example, that you have a categorical variable 
representing 3 different age groups, and you want to estimate a linear 
model.  As long as R recognizes the variable as categorical (of class 
"factor" or "ordered factor", R handles this automatically using 
"contrasts".  If this is your question, I suggest you read about 
"factors", "Formulae for Statistical Models" and "Contrasts" in "An 
Introduction to R", which is the upper-left choice after 'help.start()' 
in recent versions of R (or downloadable from www.r-project.org -> 
Documentation -> Manuals).

	  If you would like more help from this group, I believe you will 
increase your chances of getting quickly the information you seek in you 
PLEASE do read the posting guide! "www.R-project.org/posting-guide.html".

	  hope this helps.
	  spencer graves
Oana Mocila wrote: