Skip to content

Verifying the installation of profileR

Christopher David Desjardins edited this page Feb 13, 2020 · 2 revisions

Thanks!

Thank you for your interest in the profileR package! If you have any suggestions or encounter any unexpected issues, please open an issue. We also warmly welcome contributions, so please feel free to submit a pull request.

Verifying that profileR

There are two steps as a user of profileR that you can do to verify the functionality of profileR.

Verify that profileR has installed correctly.

To check this, run the following two commands,

install.packages("profileR")
library(profileR)

If you receive no output in the R Console, then profileR has installed correctly. It is possible, that a dependency has not installed correctly. If you get a warning or error message, please open an issue.

Checking the examples

Below is the output from the examples, which can be used to verify that the program is properly functioning on your computer.

── Running 24 example files ─────────────────────────────────────────────────────────── profileR ──

> ### Name: cpa
> ### Title: Criterion-Related Profile Analysis
> ### Aliases: cpa
> ### Keywords: method
> 
> ### ** Examples
> 
> 
> data(IPMMc)

> mod <- cpa(R ~ A + H + S + B, data = IPMMc)

> print(mod)
Call:
cpa(formula = R ~ A + H + S + B, data = IPMMc)

Coefficients

Call:  glm(formula = formula, family = family, data = data, na.action = na.action)

Coefficients:
(Intercept)            A            H            S            B  
   0.500000     0.009231     0.023077    -0.009231    -0.023077  

Degrees of Freedom: 5 Total (i.e. Null);  1 Residual
Null Deviance:	    1.5 
Residual Deviance: 0.04615 	AIC: -0.1779

> summary(mod)
Call:
cpa(formula = R ~ A + H + S + B, data = IPMMc)

Relability
                 R2
Full Model 0.969231
Pattern    0.969231
Level      0.000000

 Level Component
    1     2     3     4     5     6 
58.75 58.75 55.00 58.75 58.75 55.00 

 Pattern Component 
       A      H      S      B
1  16.25   1.25  -8.75  -8.75
2   1.25  16.25 -13.75  -3.75
3   5.00   5.00   0.00 -10.00
4  -8.75  -8.75  16.25   1.25
5 -13.75  -3.75   1.25  16.25
6   0.00 -10.00   5.00   5.00

> plot(mod)

> anova(mod)
Call:
cpa(formula = R ~ A + H + S + B, data = IPMMc)

Analysis of Variance Table

                 df1 df2      F value    Pr(>F)
R2.full = 0        4   1  7.87500e+00 0.2604188
R2.pat = 0         3   1  1.05000e+01 0.2221903
R2.lvl = 0         1   1  0.00000e+00 1.0000000
R2.full = R2.lvl   3   1  1.05000e+01 0.2221903
R2.full = R2.pat   1   1 -7.21645e-15 1.0000000

> ### Name: leisure
> ### Title: Leisure Activity Rankings
> ### Aliases: leisure
> ### Keywords: datasets
> 
> ### ** Examples
> 
> 
> data(leisure)

> ### Name: mpa
> ### Title: Moderated Profile Analysis
> ### Aliases: mpa
> ### Keywords: method
> 
> ### ** Examples
> 
> 
> data(mod_data)

> mod <- mpa(gpa ~ satv * major + satq * major, moderator = "major", data = bacc2001)
# -------- Executing Stage 1 --------  #
# -------- Executing Stage 2 --------  #

> summary(mod$output)

Call:
lm(formula = resp ~ 1 + level.ref + level.focal + pat.ref + pat.diff + 
    z, data = model.data)

Residuals:
     Min       1Q   Median       3Q      Max 
-143.511  -25.249    1.599   26.844  132.269 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 203.95852   10.18220  20.031  < 2e-16 ***
level.ref     0.21458    0.01786  12.014  < 2e-16 ***
level.focal  -0.02860    0.02969  -0.963    0.336    
pat.ref       2.00000    1.21898   1.641    0.101    
pat.diff      2.00000    0.50062   3.995 6.91e-05 ***
z            -3.56317   18.10308  -0.197    0.844    
---
Signif. codes:  0***0.001**0.01*0.05.0.1 ‘ ’ 1

Residual standard error: 40.78 on 1074 degrees of freedom
Multiple R-squared:  0.1867,	Adjusted R-squared:  0.1829 
F-statistic:  49.3 on 5 and 1074 DF,  p-value: < 2.2e-16


> mod$f.table
      F.stat          df1          df2      p-value 
1.596045e+01 1.000000e+00 1.074000e+03 6.908838e-05 

> summary(mod$moder.model)

Call:
lm(formula = formula, data = data, na.action = na.action)

Residuals:
     Min       1Q   Median       3Q      Max 
-143.511  -25.249    1.599   26.844  132.269 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
(Intercept)    203.95852   10.18220  20.031  < 2e-16 ***
satv             0.13776    0.01851   7.444  2.0e-13 ***
majorstem       -3.56317   18.10308  -0.197 0.844000    
satq             0.07683    0.02251   3.414 0.000665 ***
satv:majorstem  -0.12770    0.02849  -4.482  8.2e-06 ***
majorstem:satq   0.09910    0.03522   2.814 0.004984 ** 
---
Signif. codes:  0***0.001**0.01*0.05.0.1 ‘ ’ 1

Residual standard error: 40.78 on 1074 degrees of freedom
Multiple R-squared:  0.1867,	Adjusted R-squared:  0.1829 
F-statistic:  49.3 on 5 and 1074 DF,  p-value: < 2.2e-16


> ### Name: pams
> ### Title: Profile Analysis via Multidimensional Scaling
> ### Aliases: pams
> 
> ### ** Examples
> 
> 
> data(PS)

> result <- pams(PS[,2:4], dim=2)

> result
$weights.matrix
     weight1 weight2 level R.sq
[1,]     1.5 0.00000    70    1
[2,]     1.5 0.00000    40    1
[3,]     0.0 2.12132    70    1
[4,]     0.0 2.12132    40    1
[5,]    -1.5 0.00000    70    1
[6,]    -1.5 0.00000    40    1

$dimensional.configuration
    Dimension1 Dimension2
Neu  -6.666667  -2.357023
Psy   0.000000   4.714045
CD    6.666667  -2.357023


> ### Name: paos
> ### Title: Profile Analysis for One Sample with Hotelling's T-Square
> ### Aliases: paos
> 
> ### ** Examples
> 
> 
> data(nutrient) 

> paos(nutrient, scale=TRUE)
                                              T-Squared        F df1 df2 p-value
Ho: Ratios of the means over Mu0=1             1392.347 276.9559   5 732       0
Ho: All of the ratios are equal to each other  1278.073 318.2159   4 733       0

> ### Name: pbg
> ### Title: Profile Analysis by Group: Testing Parallelism, Equal Levels,
> ###   and Flatness
> ### Aliases: pbg
> 
> ### ** Examples
> 
> 
> data(spouse)

> mod <- pbg(data=spouse[,1:4], group=spouse[,5], original.names=TRUE, profile.plot=TRUE)

> print(mod) #prints average scores in the profile across two groups

Data Summary:
       Husband     Wife
item1 3.900000 3.833333
item2 3.966667 4.100000
item3 4.333333 4.633333
item4 4.400000 4.533333

> summary(mod) #prints the results of three profile by group hypothesis tests
Call:
pbg(data = spouse[, 1:4], group = spouse[, 5], original.names = TRUE, 
    profile.plot = TRUE)

Hypothesis Tests:
$`Ho: Profiles are parallel`
  Multivariate.Test Statistic Approx.F num.df den.df    p.value
1             Wilks 0.8785726 2.579917      3     56 0.06255945
2            Pillai 0.1214274 2.579917      3     56 0.06255945
3  Hotelling-Lawley 0.1382099 2.579917      3     56 0.06255945
4               Roy 0.1382099 2.579917      3     56 0.06255945

$`Ho: Profiles have equal levels`
            Df Sum Sq Mean Sq F value Pr(>F)
group        1  0.234  0.2344   1.533  0.221
Residuals   58  8.869  0.1529               

$`Ho: Profiles are flat`
        F df1 df2      p-value
1 8.18807   3  56 0.0001310162


> ### Name: pr
> ### Title: Pattern and Level Reliability via Profile Analysis
> ### Aliases: pr
> ### Keywords: methods
> 
> ### ** Examples
> 
> 
> data(EEGS)

> result <- pr(EEGS[,c(1,3,5)],EEGS[,c(2,4,6)])

> print(result)
Subscore Reliability Estimates:

         Estimate
Level   0.9245548
Pattern 0.9338338
Overall 0.9308374

> plot(result)

> ### Name: profileplot
> ### Title: Score Profile Plot
> ### Aliases: profileplot
> 
> ### ** Examples
> 
> 
> data(PS)

>  myplot <- profileplot(PS[,2:4], person.id = PS$Person,by.pattern = TRUE, original.names = TRUE)

>  myplot

> data(leisure)

> leis.plot <- profileplot(leisure[,2:4],standardize=TRUE,by.pattern=FALSE)

> leis.plot
NULL

> ### Name: spouse
> ### Title: Love and Marriage Survey for Spouses
> ### Aliases: spouse
> ### Keywords: datasets
> 
> ### ** Examples
> 
> 
> data(spouse)

> ### Name: wprifm
> ### Title: Within-Person Random Intercept Factor Model
> ### Aliases: wprifm
> 
> ### ** Examples
> 
> data <- HolzingerSwineford1939[,7:ncol(HolzingerSwineford1939)]

> wprifm(data, scale = TRUE)
lavaan 0.6-5 ended normally after 21 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of free parameters                         20
  Number of equality constraints                     1
  Row rank of the constraints matrix                 1
                                                      
  Number of observations                           301
                                                      
Model Test User Model:
                                                      
  Test statistic                               158.922
  Degrees of freedom                                26
  P-value (Chi-square)                           0.000