Displaying 12 results from an estimated 12 matches for "gastrain".

Did you mean:
gastman

2017 Jul 13

3

How to formulate quadratic function with interaction terms for the PLS fitting model?

I have two ideas about it.
1-
i) Entering variables in quadratic form is done with the command I
(variable ^ 2) -
plsr (octane ~ NIR + I (nir ^ 2), ncomp = 10, data = gasTrain, validation =
"LOO"
You could also use a new variable NIR_sq <- (NIR) ^ 2
ii) To insert a square variable, use syntax I (x ^ 2) - it is very
important to insert I before the parentheses.
iii) If you want to make the interaction between x and x ^ 2 use the
command ":" ->...

2017 Jul 13

0

How to formulate quadratic function with interaction terms for the PLS fitting model?

...ert Gunter
On Thu, Jul 13, 2017 at 3:07 AM, Luigi Biagini <luigi.biagini at gmail.com> wrote:
> I have two ideas about it.
>
> 1-
> i) Entering variables in quadratic form is done with the command I
> (variable ^ 2) -
> plsr (octane ~ NIR + I (nir ^ 2), ncomp = 10, data = gasTrain, validation =
> "LOO"
> You could also use a new variable NIR_sq <- (NIR) ^ 2
>
> ii) To insert a square variable, use syntax I (x ^ 2) - it is very
> important to insert I before the parentheses.
True, but better I believe: see ?poly.
e.g. poly(cbind(x1,x2,x3), degree...

2017 Jul 13

0

Quadratic function with interaction terms for the PLS fitting model?

...; wrote:
>
> poly(NIR, degree = 2) will work if NIR is a matrix, not a data.frame.
> The degree argument apparently *must* be explicitly named if NIR is
> not a numeric vector. AFAICS, this is unclear or unstated in ?poly.
I still get the same error with:
library(pld)
data(gasoline)
gasTrain <- gasoline[1:50,]
gas1 <- plsr(octane ~ poly(as.matrix(NIR), 2), ncomp = 10, data = gasTrain, validation = "LOO")
Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) :
invalid 'times' value
> gas1 <- plsr(octane ~ poly(as.matrix(gasTrain$NIR), deg...

2017 Jul 13

4

Quadratic function with interaction terms for the PLS fitting model?

...itting a linear model, I want to fit my
>> data with a quadratic function with interaction terms. But I am not sure
>> how. I will use an example to illustrate my problem:
>>
>> Following the example in the PLS manual:
>> ## Read data
>> data(gasoline)
>> gasTrain <- gasoline[1:50,]
>> ## Perform PLS
>> gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
>>
>> where octane ~ NIR is the model that this example is fitting with.
>>
>> NIR is a collective of variables, i.e. NIR spectra c...

2017 Jul 16

2

How to formulate quadratic function with interaction terms for the PLS fitting model?

...13, 2017 at 3:07 AM, Luigi Biagini <luigi.biagini at gmail.com> wrote:
>> I have two ideas about it.
>>
>> 1-
>> i) Entering variables in quadratic form is done with the command I
>> (variable ^ 2) -
>> plsr (octane ~ NIR + I (nir ^ 2), ncomp = 10, data = gasTrain, validation =
>> "LOO"
>> You could also use a new variable NIR_sq <- (NIR) ^ 2
>>
>> ii) To insert a square variable, use syntax I (x ^ 2) - it is very
>> important to insert I before the parentheses.
>
> True, but better I believe: see ?poly.
>...

2017 Jul 16

0

How to formulate quadratic function with interaction terms for the PLS fitting model?

...uigi Biagini <luigi.biagini at gmail.com> wrote:
>>> I have two ideas about it.
>>>
>>> 1-
>>> i) Entering variables in quadratic form is done with the command I
>>> (variable ^ 2) -
>>> plsr (octane ~ NIR + I (nir ^ 2), ncomp = 10, data = gasTrain, validation =
>>> "LOO"
>>> You could also use a new variable NIR_sq <- (NIR) ^ 2
>>>
>>> ii) To insert a square variable, use syntax I (x ^ 2) - it is very
>>> important to insert I before the parentheses.
>>
>> True, but better...

2017 Jul 13

2

Quadratic function with interaction terms for the PLS fitting model?

...ial least square on a set of
multivariate data. Instead of fitting a linear model, I want to fit my
data with a quadratic function with interaction terms. But I am not sure
how. I will use an example to illustrate my problem:
Following the example in the PLS manual:
## Read data
data(gasoline)
gasTrain <- gasoline[1:50,]
## Perform PLS
gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
where octane ~ NIR is the model that this example is fitting with.
NIR is a collective of variables, i.e. NIR spectra consists of 401 diffuse
reflectance measurements from...

2017 Jul 13

0

Quadratic function with interaction terms for the PLS fitting model?

...variate data. Instead of fitting a linear model, I want to fit my
> data with a quadratic function with interaction terms. But I am not sure
> how. I will use an example to illustrate my problem:
>
> Following the example in the PLS manual:
> ## Read data
> data(gasoline)
> gasTrain <- gasoline[1:50,]
> ## Perform PLS
> gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
>
> where octane ~ NIR is the model that this example is fitting with.
>
> NIR is a collective of variables, i.e. NIR spectra consists of 401 diffuse...

2017 Jul 13

0

Quadratic function with interaction terms for the PLS fitting model?

...to fit my
>>> data with a quadratic function with interaction terms. But I am not sure
>>> how. I will use an example to illustrate my problem:
>>>
>>> Following the example in the PLS manual:
>>> ## Read data
>>> data(gasoline)
>>> gasTrain <- gasoline[1:50,]
>>> ## Perform PLS
>>> gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
>>>
>>> where octane ~ NIR is the model that this example is fitting with.
>>>
>>> NIR is a collective of var...

2017 Jul 13

2

Quadratic function with interaction terms for the PLS fitting model?

...data with a quadratic function with interaction terms. But I am not sure
>>>> how. I will use an example to illustrate my problem:
>>>>
>>>> Following the example in the PLS manual:
>>>> ## Read data
>>>> data(gasoline)
>>>> gasTrain <- gasoline[1:50,]
>>>> ## Perform PLS
>>>> gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
>>>>
>>>> where octane ~ NIR is the model that this example is fitting with.
>>>>
>>>> NIR...

2017 Jul 13

0

Quadratic function with interaction terms for the PLS fitting model?

...nction with interaction terms. But I am not sure
>>>>> how. I will use an example to illustrate my problem:
>>>>>
>>>>> Following the example in the PLS manual:
>>>>> ## Read data
>>>>> data(gasoline)
>>>>> gasTrain <- gasoline[1:50,]
>>>>> ## Perform PLS
>>>>> gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
>>>>>
>>>>> where octane ~ NIR is the model that this example is fitting with.
>>>>>...

2017 Jul 12

0

How to formulate quadratic function with interaction terms for the PLS fitting model?

...ial least square on a set of
multivariate data. Instead of fitting a linear model, I want to fit my
data with a quadratic function with interaction terms. But I am not sure
how. I will use an example to illustrate my problem:
Following the example in the PLS manual:
## Read data
data(gasoline)
gasTrain <- gasoline[1:50,]
## Perform PLS
gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
where octane ~ NIR is the model that this example is fitting with.
NIR is a collective of variables, i.e. NIR spectra consists of 401 diffuse
reflectance measurements from...