[R] Linear regression

Bert Gunter gunter.berton at gene.com
Mon Mar 19 20:02:07 CET 2012


1. Homework assignment? We don't do homework here.

2. If not, a mixture model of some sort?  I suggest you state the
context of the problem more fully. R has several packages to do
mixture modeling, if that's what you're trying to do.

3. In any case, this cannot be done with lm() (at least without tricks).

4. In your notation below, the "separate" regressions can be stacked
into a single constrained regression model.

5. You might do better to find local statistical help, as you may have
bitten off more than you can chew.

-- Bert

On Mon, Mar 19, 2012 at 11:29 AM, Diviya Smith <diviya.smith at gmail.com> wrote:
> Hello there,
>
> I am new to using regression in R. I wanted to solve a simple regression
> problem where I have 2 equations and 2 unknowns.
>
> So lets say -
> y1 = alpha1*A + beta1*B
> y2 = alpha2*A + beta2*B
>
> y1 <- runif(100000, 0,1)
> y2 <- runif(100000,0,1)
>
> alpha1 <- 0.6
> alpha2 <- 0.75
>
> beta1 <- 1-alpha1
> beta2 <- 1-apha2
>
> I now want this equation to estimate the values of A and B. Both A and B
> are constrained to be between (0,1). I would like to use lm with these
> constraints and I am having a little trouble in defining the equations
> correctly. Any help would be most appreciated.
>
> Thank you,
> Diviya
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list