File: regression-set.Rd

package info (click to toggle)
r-cran-lava 1.8.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,816 kB
  • sloc: sh: 13; makefile: 2
file content (126 lines) | stat: -rw-r--r-- 3,981 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/regression.R
\name{regression<-}
\alias{regression<-}
\alias{regression}
\alias{regression<-.lvm}
\alias{regression.lvm}
\alias{regfix}
\alias{regfix<-}
\alias{regfix.lvm}
\alias{regfix<-.lvm}
\title{Add regression association to latent variable model}
\usage{
\method{regression}{lvm}(object = lvm(), to, from, fn = NA,
messages = lava.options()$messages, additive=TRUE, y, x, value, ...)
\method{regression}{lvm}(object, to=NULL, quick=FALSE, ...) <- value
}
\arguments{
\item{object}{\code{lvm}-object.}

\item{\dots}{Additional arguments to be passed to the low level functions}

\item{value}{A formula specifying the linear constraints or if
\code{to=NULL} a \code{list} of parameter values.}

\item{to}{Character vector of outcome(s) or formula object.}

\item{from}{Character vector of predictor(s).}

\item{fn}{Real function defining the functional form of predictors (for
simulation only).}

\item{messages}{Controls which messages are turned on/off (0: all off)}

\item{additive}{If FALSE and predictor is categorical a non-additive effect is assumed}

\item{y}{Alias for 'to'}

\item{x}{Alias for 'from'}

\item{quick}{Faster implementation without parameter constraints}
}
\value{
A \code{lvm}-object
}
\description{
Define regression association between variables in a \code{lvm}-object and
define linear constraints between model equations.
}
\details{
The \code{regression} function is used to specify linear associations
between variables of a latent variable model, and offers formula syntax
resembling the model specification of e.g. \code{lm}.

For instance, to add the following linear regression model, to the
\code{lvm}-object, \code{m}:
\deqn{ E(Y|X_1,X_2) = \beta_1 X_1 + \beta_2 X_2}
We can write

\code{regression(m) <- y ~ x1 + x2}

Multivariate models can be specified by successive calls with
\code{regression}, but multivariate formulas are also supported, e.g.

\code{regression(m) <- c(y1,y2) ~ x1 + x2}

defines
\deqn{ E(Y_i|X_1,X_2) = \beta_{1i} X_1 + \beta_{2i} X_2 }

The special function, \code{f}, can be used in the model specification to
specify linear constraints. E.g. to fix \eqn{\beta_1=\beta_2}
, we could write

\code{regression(m) <- y ~ f(x1,beta) + f(x2,beta)}

The second argument of \code{f} can also be a number (e.g. defining an
offset) or be set to \code{NA} in order to clear any previously defined
linear constraints.

Alternatively, a more straight forward notation can be used:

\code{regression(m) <- y ~ beta*x1 + beta*x2}

All the parameter values of the linear constraints can be given as the right
handside expression of the assigment function \code{regression<-} (or
\code{regfix<-}) if the first (and possibly second) argument is defined as
well. E.g:

\code{regression(m,y1~x1+x2) <- list("a1","b1")}

defines \eqn{E(Y_1|X_1,X_2) = a1 X_1 + b1 X_2}. The rhs argument can be a
mixture of character and numeric values (and NA's to remove constraints).

The function \code{regression} (called without additional arguments) can be
used to inspect the linear constraints of a \code{lvm}-object.
}
\note{
Variables will be added to the model if not already present.
}
\examples{

m <- lvm() ## Initialize empty lvm-object
### E(y1|z,v) = beta1*z + beta2*v
regression(m) <- y1 ~ z + v
### E(y2|x,z,v) = beta*x + beta*z + 2*v + beta3*u
regression(m) <- y2 ~ f(x,beta) + f(z,beta)  + f(v,2) + u
### Clear restriction on association between y and
### fix slope coefficient of u to beta
regression(m, y2 ~ v+u) <- list(NA,"beta")

regression(m) ## Examine current linear parameter constraints

## ## A multivariate model, E(yi|x1,x2) = beta[1i]*x1 + beta[2i]*x2:
m2 <- lvm(c(y1,y2) ~ x1+x2)

}
\seealso{
\code{\link{intercept<-}}, \code{\link{covariance<-}},
\code{\link{constrain<-}}, \code{\link{parameter<-}},
\code{\link{latent<-}}, \code{\link{cancel<-}}, \code{\link{kill<-}}
}
\author{
Klaus K. Holst
}
\keyword{models}
\keyword{regression}