Hi, Simon,
   
  Thank you very much for the helpful suggestion. But if the model is a partially linear model, i.e.
  y(x1)=a0+a1*x1+a2*x2+a3*s(x3)    where x1 is the decision variable
   
  I would like to evaluate y(x1) at a specific level of x2 and x3 (i.e. y is a function of x1 only). In doing this, I can optimize y(x1) with respect to x1 at the specific level of x2 and x3. Do you know if there a way to do this in R? Can gam.s be used to extract the prediction of the smooth term only(In my case, the s(x3))?
   
  Thank you again,
  Jin
  

Simon Wood <s.wood@bath.ac.uk> wrote:
  On Sunday 15 April 2007 23:36, Jin Huang wrote:
> Dear all,
>
> I fitted a non-parametric model using GAM function in R. i.e.,
> gam(y~s(x1)+s(x2)) #where s() is the smooth function
> Then I obtained the coefficients(a and b) for the non-parametric terms.
> i.e., y=a*s(x1)+b*s(x2)
-- do you mean y = \sum_i a_i d_i(x1) + \sum_i b_i e_i(x2)
where d_i and e_i are basis functions? Or do you mean something else by a and 
b here?

>
> Now if I want to use this estimated model to do optimization or
> sensitivity analysis, I am not sure how to incorporate the smooth function
> since s() may not be recognized outside GAM environment.
>
- do you actually need the whole smooth functions, or only the smooths 
evaluated at particular x1/x2 values? If it is the latter then you can use 
the `type="lpmatrix" argument to predict.gam, in order to obtain the matrix 
which maps the model coefficients to the estimated linear predictor of the 
GAM. The columns of this matrix are made up of the evaluated basis functions 
for the smooth terms, which is usually all you need.

There are some examples of this sort of thing in ?predict.gam.

best,
Simon


> Thank you in advance!
>
> Jin Huang
> North Carolina State University
>
>
>
>
>
>
>
>
> ---------------------------------
> Ahhh...imagining that irresistible "new car" smell?
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.

-- 
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603 www.maths.bath.ac.uk/~sw283

______________________________________________
R-help@stat.math.ethz.ch 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.


       
---------------------------------


	[[alternative HTML version deleted]]

