lambda_start: Estimation of starting lambda in Expectation-Maximization...

Description Usage Arguments Details Value Author(s) Examples

View source: R/lambda_start.R

Description

The function fits the GLM Poisson without regressors.

Usage

1
lambda_start(variable, X)

Arguments

variable

the vector of numbers

X

model matrix of the form X=model.matrix(~regressor). In the model without regressor the X sould be defined as X=as.matrix(rep(1, length(variable)))

Details

It fits the GLM Poisson, where variable \sim 1. The results are taken as the starting value of EM algorithm.

Value

lambda

\hat λ=\hat β X

beta

regressor parameters

glm

output of \texttt{glm}

Author(s)

Alicja Wolny–Dominiak, Michal Trzesiok

Examples

1
2
3
4
5
set.seed(1234)
variable=rpois(50,4)
X=as.matrix(rep(1, length(variable)))
t=pseudo_values(variable, mixing=c("invGauss"), lambda=4, delta=1, n=100)
lambda_m_step(variable, X, offset=t$pseudo_values)

Example output

Loading required package: gaussquad
Loading required package: polynom
Loading required package: orthopolynom
Loading required package: Rmpfr
Loading required package: gmp

Attaching package: 'gmp'

The following objects are masked from 'package:base':

    %*%, apply, crossprod, matrix, tcrossprod

C code of R package 'Rmpfr': GMP using 64 bits per limb


Attaching package: 'Rmpfr'

The following object is masked from 'package:gmp':

    outer

The following objects are masked from 'package:stats':

    dbinom, dnorm, dpois, pnorm

The following objects are masked from 'package:base':

    cbind, pmax, pmin, rbind

Loading required package: MASS
$lambda
            [,1]
 [1,] 0.02082717
 [2,] 0.02082717
 [3,] 0.02082717
 [4,] 0.02082717
 [5,] 0.02082717
 [6,] 0.02082717
 [7,] 0.02082717
 [8,] 0.02082717
 [9,] 0.02082717
[10,] 0.02082717
[11,] 0.02082717
[12,] 0.02082717
[13,] 0.02082717
[14,] 0.02082717
[15,] 0.02082717
[16,] 0.02082717
[17,] 0.02082717
[18,] 0.02082717
[19,] 0.02082717
[20,] 0.02082717
[21,] 0.02082717
[22,] 0.02082717
[23,] 0.02082717
[24,] 0.02082717
[25,] 0.02082717
[26,] 0.02082717
[27,] 0.02082717
[28,] 0.02082717
[29,] 0.02082717
[30,] 0.02082717
[31,] 0.02082717
[32,] 0.02082717
[33,] 0.02082717
[34,] 0.02082717
[35,] 0.02082717
[36,] 0.02082717
[37,] 0.02082717
[38,] 0.02082717
[39,] 0.02082717
[40,] 0.02082717
[41,] 0.02082717
[42,] 0.02082717
[43,] 0.02082717
[44,] 0.02082717
[45,] 0.02082717
[46,] 0.02082717
[47,] 0.02082717
[48,] 0.02082717
[49,] 0.02082717
[50,] 0.02082717

$beta
        X 
-3.871497 

$glm

Call:  glm(formula = variable ~ -1 + X, family = poisson(log), offset = offset)

Coefficients:
     X  
-3.871  

Degrees of Freedom: 50 Total (i.e. Null);  49 Residual
Null Deviance:	    16890 
Residual Deviance: 406.2 	AIC: 562.6

attr(,"class")
[1] "lambda_m_step"

MixedPoisson documentation built on May 2, 2019, 12:40 p.m.